timeutils is not leap second safe

Bug #1427212 reported by Ihar Hrachyshka on 2015-03-02
This bug affects 1 person
Affects Status Importance Assigned to Milestone
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) on 2015-03-03
Changed in oslo.utils:
assignee: nobody → Julien Danjou (jdanjou)
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

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

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  Edit
Everyone can see this information.

Other bug subscribers