timeutils is not leap second safe

Bug #1427212 reported by Ihar Hrachyshka
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.utils
Fix Released
Low
Ihar Hrachyshka

Bug Description

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)
+

description: updated
Changed in oslo.utils:
status: New → Confirmed
importance: Undecided → Low
Julien Danjou (jdanjou)
Changed in oslo.utils:
assignee: nobody → Julien Danjou (jdanjou)
Revision history for this message
ChangBo Guo(gcb) (glongwave) wrote :

Fix c50d8161ac251ee0c9cad6012bc7ceab4f899d6f was merged , so we can close it now.

Changed in oslo.utils:
assignee: Julien Danjou (jdanjou) → Ihar Hrachyshka (ihar-hrachyshka)
status: Confirmed → Fix Committed
Changed in oslo.utils:
milestone: none → 2.8.0
status: Fix Committed → Fix Released
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/oslo.utils 1.4.2

This issue was fixed in the openstack/oslo.utils 1.4.2 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

This issue was fixed in the openstack/oslo.utils 1.4.2 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.