From 191a0b7255bfc8898dfb2f93bdf54db2631e483a Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Tue, 12 Dec 2023 06:57:03 +0100 Subject: [PATCH] Changes after review --- dfdatetime/ole_automation_date.py | 5 ++--- tests/precisions.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dfdatetime/ole_automation_date.py b/dfdatetime/ole_automation_date.py index 977459f..22602b8 100644 --- a/dfdatetime/ole_automation_date.py +++ b/dfdatetime/ole_automation_date.py @@ -99,15 +99,14 @@ def CopyFromDateTimeString(self, time_string): hours = date_time_values.get('hours', 0) minutes = date_time_values.get('minutes', 0) seconds = date_time_values.get('seconds', 0) - nanoseconds = date_time_values.get('nanoseconds', None) + nanoseconds = date_time_values.get('nanoseconds', 0) time_zone_offset = date_time_values.get('time_zone_offset', 0) timestamp = self._GetNumberOfSecondsFromElements( year, month, day_of_month, hours, minutes, seconds) timestamp = float(timestamp) - if nanoseconds is not None: - timestamp += float(nanoseconds) / definitions.NANOSECONDS_PER_SECOND + timestamp += float(nanoseconds) / definitions.NANOSECONDS_PER_SECOND timestamp /= definitions.SECONDS_PER_DAY timestamp += self._OLE_AUTOMATION_DATE_TO_POSIX_BASE diff --git a/tests/precisions.py b/tests/precisions.py index 5ed4197..fcd558a 100644 --- a/tests/precisions.py +++ b/tests/precisions.py @@ -12,7 +12,7 @@ class DateTimePrecisionHelperTest(unittest.TestCase): """Tests for the date time precision helper interface.""" - def testCopNanoosecondsToFractionOfSecond(self): + def testCopyNanosecondsToFractionOfSecond(self): """Tests the CopyNanosecondsToFractionOfSecond function.""" precision_helper = precisions.DateTimePrecisionHelper