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 akira
Recipients akira, pitrou, regu0004, terry.reedy
Date 2014-09-01.12:36:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1409575015.01.0.789639886282.issue22296@psf.upfronthosting.co.za>
In-reply-to
Content
timestamp() method works correctly for an aware datetime objects
as in my example (notice: timezone.utc in the code).

The issue is not that it is a manual computation,
the issue is that it is incorrect:

  #XXX WRONG, DO NOT DO IT
  time.mktime(datetime.datetime.utcnow().timetuple())

On older Python versions, given a utc time as a naive datetime
object, POSIX timestamp is:

  ts = (utc_dt - datetime(1970, 1, 1)).total_seconds()
  utc_dt = datetime(1970, 1, 1) + timedelta(seconds=ts) # in reverse
History
Date User Action Args
2014-09-01 12:36:55akirasetrecipients: + akira, terry.reedy, pitrou, regu0004
2014-09-01 12:36:55akirasetmessageid: <1409575015.01.0.789639886282.issue22296@psf.upfronthosting.co.za>
2014-09-01 12:36:54akiralinkissue22296 messages
2014-09-01 12:36:54akiracreate