summaryrefslogtreecommitdiffstats
path: root/openstack/common/timeutils.py
Commit message (Collapse)AuthorAgeFilesLines
* Enable hacking H404 test.Dina Belova2013-06-111-6/+6
| | | | | | H404 - multi line docstring should start with a summary. Change-Id: I2099e1ee81ff9657f7a07401b8e8f3327d03bdbd
* Enable hacking H402 testSergey Lukjanov2013-06-031-4/+4
| | | | | | H402 one line docstring needs punctuation Change-Id: Ie848453cace318d8310cdf0234c512f4c1121119
* Enable hacking H403 testSergey Lukjanov2013-05-301-1/+2
| | | | | | H403 multi line docstring end on new line Change-Id: I33249651026b54ef346214965e909835288bb14e
* Fix Copyright Headers - Rename LLC to FoundationDavanum Srinivas2013-03-111-1/+1
| | | | | | One code change, rest are in headers Change-Id: I73f59681358629e1ad74e49d3d3ca13fcb5c2eb1
* support ISO 8601 micro-second precisionGuang Yee2013-03-041-6/+10
| | | | | | Bug 1134802 Change-Id: I9cc3c9d9324314d293f01f047882eb6be06e02dd
* timeutils: considers that now is soonJulien Danjou2013-01-311-1/+1
| | | | | | | | | This is a follow-up to Doug suggestion at https://review.openstack.org/#/c/20323/2/openstack/common/timeutils.py Change-Id: Ic318202234202e56054df1b5cc7f82a404c307bc Signed-off-by: Julien Danjou <julien@danjou.info>
* Merge "UTC ISO8601 from timestamp"Jenkins2013-01-231-0/+5
|\
| * UTC ISO8601 from timestampFlaper Fesp2013-01-211-0/+5
| | | | | | | | | | | | | | | | | | 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
* | Import timeutils.is_soon from keystoneclientJulien Danjou2013-01-231-0/+13
|/ | | | | | | | | | This is a function defined as will_expire_soon at least twice in python-keystoneclient, and it's actually quite handy. There is a comment on that code about moving to timeutils, and it actually sounds like a good idea since I'm likely to use it in Ceilometer, so here it is. Change-Id: Idf208ce9e7ce9048a38d98212b7f730c6b7c8288 Signed-off-by: Julien Danjou <julien@danjou.info>
* Use basestring instead of str for type check.Flaper Fesp2013-01-041-2/+2
| | | | | | | | | | | | Change-Id: I1dbf453cc08bd8aaeb4fee2491a1e8aa74f8bee3 introduced some checks to is_older_than and is_newer_than functions against str instead of basestring. I'm aware that basestring doesn't exist in Python3 but since it isn't a target right now and there's no "standard" way to support it right now in openstack. Change-Id: I8d67d384637dfdde3f5621052d8511e7b6ecab7b
* Make time comparison functions accept stringsDan Smith2013-01-041-0/+4
| | | | | | | This patch makes is_older_than() and is_newer_than() accept timestamps in string format, as returned from strtime(). Change-Id: I1dbf453cc08bd8aaeb4fee2491a1e8aa74f8bee3
* Account for tasks duration in LoopingCall delayEoghan Glynn2012-11-191-3/+13
| | | | | | | | | | | | Fixes bug 1079725 Previously the time spent executing tasks was not accounted for when determining how much time to sleep between task runs. Now we subtract the duration of the last tasks run from the next sleep interval. Change-Id: I4b3e27d4aaa21d020159d46eea40bdd80361cea7
* Convenience wrapper for datetime.timedelta.total_seconds()Eoghan Glynn2012-11-191-0/+13
| | | | | | | Allows time deltas in seconds to be concisely calculated for py26 and py27. Change-Id: I8987af1f892fda0a72f5eb0d45f94c595792dc78
* Added is_newer_than functionSirisha Devineni2012-10-091-0/+5
| | | | | | | | | | Added is_newer_than function to compare if the provided time is newer than current time for specified number of seconds Fixes bug 1036343 Change-Id: Ic133b0e7e2337b6b0fdad244ded6a93f8db48379
* Normalize_time() always return naive objectYunhong, Jiang2012-09-131-2/+4
| | | | | | | | | | | | | | | | | | | | | | | Currently the timeutils.normalize_time() returns naive datetime object when parameter timestamp is an naive object or a non-UTC aware datetime object, and returns aware datetime object if parameter timestamp is a UTC aware datetime object. The basic problem here is that utcoffset() of None means the object is naive but a utcoffset() of zero means that the object is aware but represents UTC time. This is fragile implementation and will trigger potential issue, because aware/native datetime is not interoperatable. For example, "timeutils.utcnow() > timeutils.normalize_time(m)" will success at most time, while trigger TypeError if m is a UTC aware object. We want to normalize all objects into naive objects. Fixes bug 1048636 Change-Id: I4a09246fa8f0dd63ca54362b877aa825d9b79772 Signed-off-by: Yunhong, Jiang <yunhong.jiang@intel.com>
* Use pep8 v1.3.3Zhongyue Luo2012-09-131-3/+7
| | | | | | | Fixed indents which violate pep8 1.3.3 Also added .mailmap file to coalesce commits Change-Id: Ia7a788a28e6c0fd9cb52fb7ea477cddd7d589e58
* Fix spelling typosRongzeZhu2012-08-171-2/+2
| | | | | | | | Fixes for: * openstack/common/excutils.py * openstack/common/timeutils.py Change-Id: Ic747de783e64fae00edf5af64d1a79a4edcf8412
* Support for marshalling datetime while preserving microseconds.SandyWalsh2012-08-101-0/+18
| | | | | | Needed for performance measurement via "inflight" service. Change-Id: I5c1a8395b4cbc5fc0f8649b3af8130f45dd401bb
* Remove unused importsJoe Gordon2012-07-261-1/+0
| | | | Change-Id: Ia2900e50263950ba40ba86e685640cacaa2137a7
* Fix utcnow_ts to return UTC timestampZhongyue Luo2012-06-111-1/+2
| | | | | | | | Fixes bug #1011121 Use calendar.timegm instead of time.mktime Change-Id: Idb8d470f1ef90162641d21122699a026fa38faf1
* Add nova time util functions to timeutilsZhongyue Luo2012-06-061-0/+35
| | | | | | | | | | | | | | | | Fixes bug #1009410 1. Add the following functions from nova/utils.py - strtime - parse_strtime - is_older_than - utcnow_ts - advance_time_delta - advance_time_seconds 2. Write unittests in tests/unit/test_timeutils.py Change-Id: Ie0bba90833e2ed31bb5ab867a7c1a76a9901cacb
* Replace datetime.utcnow with timeutils.utcnowZhongyue Luo2012-06-051-1/+1
| | | | | | | | Fixes bug #1008064 Replaced datetime.utcnow usage with timeutils.utcnow Change-Id: I8bfdc1abefc3891497554335a3078d4028ef8ac9
* Create openstack.common.timeutils.Russell Bryant2012-04-041-0/+73
Split time related utility functions out of openstack.common.utils into a new module, timeutils. Change-Id: Ic09952cd48e0b4548e410926cc456cbd515a4e56