2015-03-02 13:21:39 |
Ihar Hrachyshka |
description |
We are having a leap second in Juno: http://www.usatoday.com/story/tech/2015/01/08/computer-chaos-feares/21433363/
It will mean we'll have 61 seconds at that moment. datetime module is not leap aware and will fail with "ValueError: second must be in 0..59" if seconds=60 is passed. The proper response to it would be to avoid using datetime and switch to time module that operates with struct_time objects.
The problem is that timeutils API is bound to datetime. Specifically, the following functions are affected:
- parse_strtime
- utcnow
- unmarshall_time
This may mean that we can't fix it as a bug, but may need to introduce new proper time API.
An easy way to check that we're affected is e.g.:
+ def test_unmarshall_time_leap_second(self):
+ leap_time = dict(day=30, month=6, year=2015,
+ hour=23, minute=59, second=60, microsecond=0)
+ leap_datetime = timeutils.unmarshall_time(leap_time)
+ |
We are having a leap second in June: http://www.usatoday.com/story/tech/2015/01/08/computer-chaos-feares/21433363/
It will mean we'll have 61 seconds at that moment. datetime module is not leap aware and will fail with "ValueError: second must be in 0..59" if seconds=60 is passed. The proper response to it would be to avoid using datetime and switch to time module that operates with struct_time objects.
The problem is that timeutils API is bound to datetime. Specifically, the following functions are affected:
- parse_strtime
- utcnow
- unmarshall_time
This may mean that we can't fix it as a bug, but may need to introduce new proper time API.
An easy way to check that we're affected is e.g.:
+ def test_unmarshall_time_leap_second(self):
+ leap_time = dict(day=30, month=6, year=2015,
+ hour=23, minute=59, second=60, microsecond=0)
+ leap_datetime = timeutils.unmarshall_time(leap_time)
+ |
|