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 belopolsky
Recipients Dave Johansen, belopolsky, vstinner
Date 2017-08-16.22:47:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1502923675.64.0.361324007471.issue31212@psf.upfronthosting.co.za>
In-reply-to
Content
BTW, I was originally against introducing .timestamp() method and this issue illustrates why it is problematic: people use it without understanding what it does.  If you want the distance between datetime.min and datetime(1970,1,1) in seconds - compute it explicitly:

>>> (datetime.min - datetime(1970,1,1)) / timedelta(0, 1)
-62135596800.0

If you don't want to loose precision is roundtriping between datetimes and numbers - use microseconds:

>>> (datetime.min - datetime(1970,1,1)) // datetime.resolution
-62135596800000000

It is perfectly fine to work with naive datetimes and ignore the timezone issues when all your timestamps are in one timezones, but if you choose to ignore timezones - don't use .timestamp().
History
Date User Action Args
2017-08-16 22:47:55belopolskysetrecipients: + belopolsky, vstinner, Dave Johansen
2017-08-16 22:47:55belopolskysetmessageid: <1502923675.64.0.361324007471.issue31212@psf.upfronthosting.co.za>
2017-08-16 22:47:55belopolskylinkissue31212 messages
2017-08-16 22:47:55belopolskycreate