diff options
author | Flaper Fesp <flaper87@gmail.com> | 2013-01-21 16:31:51 +0100 |
---|---|---|
committer | Flaper Fesp <flaper87@gmail.com> | 2013-01-21 18:20:27 +0100 |
commit | d3a4c8e8f466d5c7b2f5f8c076a48326e5bbaa40 (patch) | |
tree | 8492c6427d2b2c1f570709e2fe7f1da849ef5784 /openstack | |
parent | b1c5269b20e58213da93254537435b67c258f236 (diff) | |
download | oslo-d3a4c8e8f466d5c7b2f5f8c076a48326e5bbaa40.tar.gz oslo-d3a4c8e8f466d5c7b2f5f8c076a48326e5bbaa40.tar.xz oslo-d3a4c8e8f466d5c7b2f5f8c076a48326e5bbaa40.zip |
UTC ISO8601 from timestamp
Taken from glance xattr.py module. This function converts timestamp
formated dates into a UTC Iso 8601 date. It is being required in
multiple places now (mostly on clients printing dates) in order to make
dates human readable.
Change-Id: I6f19325a4c2df241a0ef76bd256280a2930d9265
Diffstat (limited to 'openstack')
-rw-r--r-- | openstack/common/timeutils.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/openstack/common/timeutils.py b/openstack/common/timeutils.py index 0f34608..5fd158d 100644 --- a/openstack/common/timeutils.py +++ b/openstack/common/timeutils.py @@ -98,6 +98,11 @@ def utcnow(): return datetime.datetime.utcnow() +def iso8601_from_timestamp(timestamp): + """Returns a iso8601 formated date from timestamp""" + return isotime(datetime.datetime.utcfromtimestamp(timestamp)) + + utcnow.override_time = None |