This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gpetty
Recipients gpetty
Date 2020-06-25.21:22:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1593120133.28.0.499070536644.issue41118@roundup.psfhosted.org>
In-reply-to
Content
For complete context, see https://stackoverflow.com/questions/62582386/how-do-i-get-a-naive-datetime-object-that-correctly-uses-utc-inputs-and-preserve

Short version: It does not seem correct that a datetime object produced *from* a POSIX timestamp using utcfromtimestamp should then return a different timestamp.  As a user, I would like to be able to count on the POSIX timestamp as being the one conserved property of a datetime object, regardless of whether it is naive or time zone aware.

> dt0 = dt.datetime(year=2020, month=1, day=1,hour=0,minute=0, tzinfo=pytz.utc)
> print(dt0)

2020-01-01 00:00:00+00:00

> ts0 = dt0.timestamp()
> print(ts0)

1577836800.0

> dt1 = dt.datetime.utcfromtimestamp(ts0)
> print(dt1)

2020-01-01 00:00:00

> ts1 = dt1.timestamp()
> print(ts1)

1577858400.0
History
Date User Action Args
2020-06-25 21:22:13gpettysetrecipients: + gpetty
2020-06-25 21:22:13gpettysetmessageid: <1593120133.28.0.499070536644.issue41118@roundup.psfhosted.org>
2020-06-25 21:22:13gpettylinkissue41118 messages
2020-06-25 21:22:13gpettycreate