summaryrefslogtreecommitdiffstats
path: root/Lib/datetime.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/datetime.py')
-rw-r--r--Lib/datetime.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/datetime.py b/Lib/datetime.py
index d661460..5ba2ddb 100644
--- a/Lib/datetime.py
+++ b/Lib/datetime.py
@@ -1384,7 +1384,7 @@ class datetime(date):
converter = _time.localtime if tz is None else _time.gmtime
t, frac = divmod(t, 1.0)
- us = int(frac * 1e6)
+ us = _round_half_up(frac * 1e6)
# If timestamp is less than one microsecond smaller than a
# full second, us can be rounded up to 1000000. In this case,
@@ -1404,7 +1404,7 @@ class datetime(date):
def utcfromtimestamp(cls, t):
"""Construct a naive UTC datetime from a POSIX timestamp."""
t, frac = divmod(t, 1.0)
- us = int(frac * 1e6)
+ us = _round_half_up(frac * 1e6)
# If timestamp is less than one microsecond smaller than a
# full second, us can be rounded up to 1000000. In this case,