You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Timestamp conversion on windows fails with timestamps close to EPOCH #81708
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2019-07-09.10:32:25.056>labels= ['3.8', 'type-bug', '3.7', '3.9', 'OS-windows']
title='Timestamp conversion on windows fails with timestamps close to EPOCH'updated_at=<Date2020-01-10.12:29:05.237>user='https://github.com/Dschoni'
This indeed seems to be a duplicate of 29097, which is fixed in Python 3.7, so we can close this bug. Thank you for your report Dschoni, and thank you for finding the duplicate Ma Lin!
No, this needs someone who's more of an expert in time functions than me. Unless you want to wait for me to get up to speed (no promises, my learning list is pretty long).
Python 3.15.0a5+ (heads/main:f5685a266b2, Jan 15 2026, 10:57:22) [MSC v.1944 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> datetime.fromtimestamp(1).timestamp()
1.0
Activity
Dschoni commentedon Jul 9, 2019
A long description of the issue can be found on SO here: https://stackoverflow.com/questions/56931738/python-crash-on-windows-with-a-datetime-close-to-the-epoch?noredirect=1#comment100413591_56931738
TL;DR:
This fails on windows:
animalize commentedon Jul 10, 2019
Looks like a similar problem to bpo-29097.
Neijwiert tried to analyzed it in stackoverflow:
https://stackoverflow.com/questions/56931738/
pganssle commentedon Nov 1, 2019
This indeed seems to be a duplicate of 29097, which is fixed in Python 3.7, so we can close this bug. Thank you for your report Dschoni, and thank you for finding the duplicate Ma Lin!
animalize commentedon Nov 1, 2019
bpo-29097 fixed bug in
datetime.fromtimestamp().But this issue is about
datetime.timestamp(), not fixed yet.pganssle commentedon Nov 1, 2019
Ah, my mistake. The examples all use
datetime.fromtimestamp, so I didn't notice that it was failing only on thetimestampside. Re-opening, thanks!Ev2geny commentedon Oct 18, 2022
Just narrowed down the problem little bit:
the error happens in the method
timestamp()only on Windows
On the native datetime object (without timezone info)
On the dates a couple of days after 1 January 1970 and all the dates before that
This was tested on Windows 10 Python 3.10.5
On Ubuntu all of the tests just run
2 remaining items
zooba commentedon Oct 20, 2022
No, this needs someone who's more of an expert in time functions than me. Unless you want to wait for me to get up to speed (no promises, my learning list is pretty long).
achoum commentedon Mar 21, 2024
The core problem of this issue likely also impact #94414
At least both the
timestamp()andastimezone()functions are impacted on Windows 10 and Windows 11fix(Python) Use timezone-aware timestamps in some unit tests on Windo…
StanFromIreland commentedon Mar 9, 2025
pekkaklarck commentedon Apr 30, 2025
I encountered this issue as well.
datetime.timetuple()doesn't seem to be affected, so using it in combination withtime.mktime()is a workaround:The above drops microseconds, but taking them into account isn't that hard:
vstinner commentedon Jan 15, 2026
Issue fixed by #143463.