[openstack-dev] [all][oslo] Parse ISO8601 (open) time intervals

Doug Hellmann doug at doughellmann.com
Tue Sep 27 16:03:06 UTC 2016


Excerpts from milanisko k's message of 2016-09-27 12:30:09 +0000:
> Hello Stackers!
> 
> The ironic inspector project keeps track of introspection finished_at time
> stamps.
> We're just discussing how to reasonably query time ranges over the API[1]
> to serve matching introspection statuses to the user.
> Wikipedia[2] mentions the ISO8601 time interval specification (and there
> are open-interval extensions to that).
> It would be nice to be able to specify a query like :
>      /v1/introspection?finished_at=2016:09:27:14:17/PT1H
> to fetch all introspection statuses that finished within 1hour around 14:17
> Today,
> or to be able to state an open-ended interval:
>     /v1/introspection?finished_at=2016:09:27:14:17/
> but oslo_utils.timeutils lacks parsing support for ISO8061 time intervals.
> 
> I'd like to ask whether other projects need to parse time intervals and/or
> how do they achieve that.
> 
> Thanks!
> milan
> 
> [1]
> https://review.openstack.org/#/c/375045/3/specs/list-introspection-statuses.rst
> [2] https://en.wikipedia.org/wiki/ISO_8601#Time_intervals

You may want to have a look at the dateutil library.
https://dateutil.readthedocs.io/en/stable/

Doug



More information about the OpenStack-dev mailing list