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 vstinner
Recipients belopolsky, doughellmann, vstinner
Date 2015-03-03.15:37:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1425397041.08.0.0773357166123.issue23574@psf.upfronthosting.co.za>
In-reply-to
Content
Ignoring leap seconds introduces unexpected result.

datetime.timestamp -> datetime.fromtimestamp drops one second:

$ ./python
Python 3.5.0a1+ (default:760f222103c7+, Mar  3 2015, 15:36:36) 
>>> t=datetime.datetime(2012, 6, 30, 23, 59, 60).timestamp()
>>> datetime.datetime.fromtimestamp(t)
datetime.datetime(2012, 6, 30, 23, 59, 59)

time and datetime modules behave differently:

$ ./python
Python 3.5.0a1+ (default:760f222103c7+, Mar  3 2015, 15:36:36) 
>>> import datetime, time
>>> t1=datetime.datetime(2012, 6, 30, 23, 59, 59).timestamp()
>>> t2=datetime.datetime(2012, 6, 30, 23, 59, 60).timestamp()
>>> t2-t1
0.0

>>> t3=time.mktime((2012, 6, 30, 23, 59, 59, -1, -1, -1))
>>> t4=time.mktime((2012, 6, 30, 23, 59, 60, -1, -1, -1))
>>> t4-t3
1.0

>>> t1 == t2 == t3
True
>>> t3, t4
(1341093599.0, 1341093600.0)
History
Date User Action Args
2015-03-03 15:37:21vstinnersetrecipients: + vstinner, belopolsky, doughellmann
2015-03-03 15:37:21vstinnersetmessageid: <1425397041.08.0.0773357166123.issue23574@psf.upfronthosting.co.za>
2015-03-03 15:37:21vstinnerlinkissue23574 messages
2015-03-03 15:37:20vstinnercreate