◐ Shell
clean mode source ↗

Message 315418 - Python tracker

I agree this isn't a bug (and it was right to close it).  I expect the OP is confused about what the `.timestamp()` method does, though.  This note in the docs directly address what happens in their problematic `datetime.utcnow().timestamp()` case:

"""
Note There is no method to obtain the POSIX timestamp directly from a naive datetime instance representing UTC time. If your application uses this convention and your system timezone is not set to UTC, you can obtain the POSIX timestamp by supplying tzinfo=timezone.utc:

timestamp = dt.replace(tzinfo=timezone.utc).timestamp()

or by calculating the timestamp directly:

timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)
"""