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 cameris
Recipients cameris
Date 2015-02-03.11:24:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1422962642.68.0.522001893601.issue23388@psf.upfronthosting.co.za>
In-reply-to
Content
The following occured on linux with python 3.4.2, the machines local timezone is tz2:

>>> import datetime

>>> tz1 = datetime.timezone.utc; tz2 = datetime.timezone(datetime.timedelta(seconds=3600)); tz3 = datetime.timezone(datetime.timedelta(seconds=18000))

>>> d1 = datetime.datetime.now(tz=tz1); d2 = datetime.datetime.now(tz=tz2); d3 = datetime.datetime.now(tz=tz3)

>>> d1.timestamp(), d2.timestamp(), d3.timestamp()
(1422962091.603168, 1422962091.603181, 1422962091.603185)

>>> d1.strftime('%s'), d2.strftime('%s'), d3.strftime('%s')
('1422958491', '1422962091', '1422976491')

Or in other words:
>>> d1.strftime('%s') == str(int(d1.timestamp())), d2.strftime('%s') == str(int(d2.timestamp())), d3.strftime('%s') == str(int(d3.timestamp()))
(False, True, False)

Expected result of the last line would be (True, True, True).
History
Date User Action Args
2015-02-03 11:24:02camerissetrecipients: + cameris
2015-02-03 11:24:02camerissetmessageid: <1422962642.68.0.522001893601.issue23388@psf.upfronthosting.co.za>
2015-02-03 11:24:02camerislinkissue23388 messages
2015-02-03 11:24:02cameriscreate