[issue44663] Possible bug in datetime utc

Tim Peters report at bugs.python.org
Sat Jul 17 19:41:41 EDT 2021


Tim Peters <tim at python.org> added the comment:

> It looks like the difference one would expect from (fast) human input)

Nope, the timestamps in the original report are about 3 hours apart (10808+ seconds).

Reports like these are often much clearer if they state the timezone of the system they're running on.

Plausible here: as the docs say, `utcnow()` returns a _naive_ datetime - no timezone info is attached.

But `.timestamp()`:

"""
Naive datetime instances are assumed to represent local time 
"""

So I _expect_ the results to differ unless the box this is running on uses UTC as its local time.

On my box, in native timezone CDT, the two ways are 5 hours apart, which is indeed CDT's offset from UTC.

----------
nosy: +tim.peters

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44663>
_______________________________________


More information about the Python-bugs-list mailing list