Skip to content

Commit 15c5520

Browse files
committed
Avoid double-adding microseconds in _pydatetime datetime.fromtimestamp.
1 parent 7453c3c commit 15c5520

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/_pydatetime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,7 @@ def _fromtimestamp(cls, t, utc, tz):
18721872
if t < 0 and sys.platform.startswith("win"):
18731873
# Windows converters throw an OSError for negative values.
18741874
y, m, d, hh, mm, ss, weekday, jday, dst = converter(0)
1875-
result = cls(y, m, d, hh, mm, ss, us, tz)
1875+
result = cls(y, m, d, hh, mm, ss, 0, tz)
18761876
return result + timedelta(seconds=t, microseconds=us)
18771877
y, m, d, hh, mm, ss, weekday, jday, dst = converter(t)
18781878
ss = min(ss, 59) # clamp out leap seconds if the platform has them

0 commit comments

Comments
 (0)