Skip to content

Commit

Permalink
Changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Dec 12, 2023
1 parent 3f626aa commit 191a0b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions dfdatetime/ole_automation_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/precisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 191a0b7

Please sign in to comment.