[issue39970] Combined behavior of datetime.datetime.timestamp() and datetime.datetime.utcnow() on non-UTC timezoned machines

2020-03-17 Thread Yi Luan
Yi Luan added the comment: Hi Paul, Yes, I totally agree with you, and I should follow your advice and not to pass timestamps as representations of arbitrary datetime for interop usage. However in my particular case, I'm not the person who can make such type of decisions. Perhaps I'm very

[issue39970] Combined behavior of datetime.datetime.timestamp() and datetime.datetime.utcnow() on non-UTC timezoned machines

2020-03-16 Thread Paul Ganssle
Paul Ganssle added the comment: @Yi Luan I think you may misunderstand what the `.timestamp()` function does - it returns an epoch time, which is the amount of time (in seconds) elapsed since the Unix epoch: https://en.wikipedia.org/wiki/Unix_time The number is not different depending on

[issue39970] Combined behavior of datetime.datetime.timestamp() and datetime.datetime.utcnow() on non-UTC timezoned machines

2020-03-15 Thread Yi Luan
Yi Luan added the comment: Sorry to make changes again but I typed his name wrong = =! It's Scott Meyers. Apologies. -- ___ Python tracker ___

[issue39970] Combined behavior of datetime.datetime.timestamp() and datetime.datetime.utcnow() on non-UTC timezoned machines

2020-03-15 Thread Yi Luan
Yi Luan added the comment: Hi, Thanks for taking time to reply my question. I suppose the title I put was a bit confusing. And the recommended way to generate time in UTC does solve this issue, in Python. However the message I was trying to convey is, the behavior of timestamp() is one

[issue39970] Combined behavior of datetime.datetime.timestamp() and datetime.datetime.utcnow() on non-UTC timezoned machines

2020-03-15 Thread Alexander Belopolsky
Change by Alexander Belopolsky : -- resolution: wont fix -> duplicate ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue39970] Combined behavior of datetime.datetime.timestamp() and datetime.datetime.utcnow() on non-UTC timezoned machines

2020-03-15 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: This is a duplicate of issue 33293. -- superseder: -> Using datetime.datetime.utcnow().timestamp() in Python3.6.0 can't get correct UTC timestamp. ___ Python tracker

[issue39970] Combined behavior of datetime.datetime.timestamp() and datetime.datetime.utcnow() on non-UTC timezoned machines

2020-03-15 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I am sure this has been reported before – I will try to find the relevant issue. This behavior is correct and documented. The only improvement that we can consider is to make it more explicit that utcnow is deprecated and the correct way to obtain

[issue39970] Combined behavior of datetime.datetime.timestamp() and datetime.datetime.utcnow() on non-UTC timezoned machines

2020-03-15 Thread Paul Ganssle
Paul Ganssle added the comment: This is the intended behavior of these functions, and there is actually now a warning on both the utcnow and utcfromtimestamp functionsto reflect this: https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow I would say that the correct

[issue39970] Combined behavior of datetime.datetime.timestamp() and datetime.datetime.utcnow() on non-UTC timezoned machines

2020-03-15 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +belopolsky, p-ganssle ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue39970] Combined behavior of datetime.datetime.timestamp() and datetime.datetime.utcnow() on non-UTC timezoned machines

2020-03-15 Thread Yi Luan
New submission from Yi Luan : Hello, Apologies if this was a duplicate issue. I guess the most concise way of saying this is that when doing: >>> datetime.datetime.utcnow().timestamp() on a machine whose local time isn't the UTC time, the above code will not return the correct timestamp.