[issue23574] datetime: support leap seconds

2020-03-29 Thread STINNER Victor
STINNER Victor added the comment: One option to explore is to add a "leap seconds" field to datetime.datetime which can be negative (just in case someone decides to add negative leap seconds in the future). It can use in operations which involve time zones, it can be serialized/deserialized

[issue23574] datetime: support leap seconds

2020-03-28 Thread Maximilian Nöthe
Maximilian Nöthe added the comment: Could this be revisited? Especially now that datetime supports `fromisoformat`, as there are valid ISO8601 timestamps in UTC out there, that contain the leap seconds, e.g. files describing when those occured or will occur. E.g. the NTP Leap second file: ht

[issue23574] datetime: support leap seconds

2015-07-31 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Please redirect this discussion to the recently opened datetime-sig mailing list. https://mail.python.org/pipermail/datetime-sig/ -- ___ Python tracker

[issue23574] datetime: support leap seconds

2015-07-31 Thread dlroo
dlroo added the comment: Is it possible to modify datetime so that the check_time_args function in the datetimemodule.c does not error when given a seconds value of greater than 59? I was thinking that if the seconds were greater than 59, the seconds are set to 59 and any extra seconds are ke

[issue23574] datetime: support leap seconds

2015-07-31 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 21.07.2015 22:15, dlroo wrote: > > dlroo added the comment: > > If you are using mx.DateTime make certain you do not use the .strftime > method. If you use .strftime method and have a 60th second in your DateTime > object it will crash python with no

[issue23574] datetime: support leap seconds

2015-07-21 Thread dlroo
dlroo added the comment: If you are using mx.DateTime make certain you do not use the .strftime method. If you use .strftime method and have a 60th second in your DateTime object it will crash python with no error message. This occurs because the .strftime method is fully inherited from Pyth

[issue23574] datetime: support leap seconds

2015-05-27 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Here's what mxDateTime uses: >>> import mx.DateTime >>> >>> t1 = mx.DateTime.DateTime(2012,6,30,23,59,60) >>> t2 = mx.DateTime.DateTime(2012,7,1,0,0,0) >>> >>> t1 >>> t2 >>> >>> t2-t1 >>> (t2-t1).seconds 0.0 >>> >>> t1 + mx.DateTime.oneSecond It preserv

[issue23574] datetime: support leap seconds

2015-05-25 Thread STINNER Victor
STINNER Victor added the comment: Sorry, I give up on this issue. I don't know how to fix it, nor if it's possible to fix it. -- resolution: -> wont fix status: open -> closed ___ Python tracker _

[issue23574] datetime: support leap seconds

2015-03-12 Thread Akira Li
Akira Li added the comment: POSIX timestamp doesn't count (literally) past/future leap seconds. It allows to find out that the timestamp 2**31-1 corresponds to 2038-01-19T03:14:07Z (UTC) regardless of how many leap seconds will occur before 2038: >>> from datetime import datetime, timedelta

[issue23574] datetime: support leap seconds

2015-03-06 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > POSIX is a ``standard'' designed by a vendor consortium several years ago to > eliminate progress and protect the installed base. No, POSIX is an attempt to bring some sanity to the installed base of human calendars. The established standard tell's u

[issue23574] datetime: support leap seconds

2015-03-03 Thread STINNER Victor
STINNER Victor added the comment: Oh, mktime() returns the same timestamp with and without the leap second: >>> time.mktime((2012, 6, 30, 23, 59, 59, -1, -1, -1)) 1341093599.0 >>> time.mktime((2012, 6, 30, 23, 59, 60, -1, -1, -1)) 1341093600.0 >>> time.mktime((2012, 7, 1, 0, 0, 0, -1, -1, -1)) 1

[issue23574] datetime: support leap seconds

2015-03-03 Thread STINNER Victor
STINNER Victor added the comment: support_leap_seconds.patch: different approach, accept second=60. Problem: fromtimestamp() returns the wrong day. haypo@smithers$ ./python Python 3.5.0a1+ (default:760f222103c7+, Mar 3 2015, 15:36:36) >>> import datetime >>> datetime.datetime(2012, 6, 30, 23,

[issue23574] datetime: support leap seconds

2015-03-03 Thread STINNER Victor
STINNER Victor added the comment: 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() >>> dateti

[issue23574] datetime: support leap seconds

2015-03-03 Thread Doug Hellmann
Changes by Doug Hellmann : -- nosy: +doughellmann ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue23574] datetime: support leap seconds

2015-03-03 Thread STINNER Victor
STINNER Victor added the comment: Leap seconds are ignored, so a difference of and is zero: >>> import datetime >>> t1=datetime.datetime(2012, 6, 30, 23, 59, 59) >>> t2=datetime.datetime(2012, 6, 30, 23, 59, 59) >>> t2-t1 datetime.timedelta(0) Supporting leap seconds might be possible, but i

[issue23574] datetime: support leap seconds

2015-03-03 Thread STINNER Victor
New submission from STINNER Victor: A leap second will be added in June 2015: http://www.usatoday.com/story/tech/2015/01/08/computer-chaos-feares/21433363/ The datetime module explicitly doesn't support leap seconds: https://docs.python.org/dev/library/datetime.html#datetime.date.fromtimestamp "

[issue23574] datetime: support leap seconds

2015-03-03 Thread STINNER Victor
Changes by STINNER Victor : -- keywords: +patch Added file: http://bugs.python.org/file38317/datetime_leapsecond.patch ___ Python tracker ___