summaryrefslogtreecommitdiffstats
path: root/tests/unit/test_timeutils.py
Commit message (Collapse)AuthorAgeFilesLines
* Removes leading zeros on integers in test_timeutilsZhongyue Luo2013-05-101-13/+13
| | | | Change-Id: If1cb92ba0ff1a57ab8940d9f9e1fe66ffd34441a
* 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-0/+15
| | | | | | Bug 1134802 Change-Id: I9cc3c9d9324314d293f01f047882eb6be06e02dd
* timeutils: considers that now is soonJulien Danjou2013-01-311-6/+11
| | | | | | | | | 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 "Replace direct use of testtools BaseTestCase."Jenkins2013-01-281-3/+3
|\
| * Replace direct use of testtools BaseTestCase.Monty Taylor2013-01-241-3/+3
| | | | | | | | | | | | | | | | | | Using the BaseTestCase across the tests in the tree lets us put in log fixtures and consistently handle mox and stubout. Part of blueprint grizzly-testtools. Change-Id: Iba7eb2c63b0c514009b2c28e5930b27726a147b0
* | Merge "Use testtools as test base class."Jenkins2013-01-281-6/+5
|\|
| * Use testtools as test base class.Monty Taylor2013-01-241-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | On the path to testr migration, we need to replace the unittest base classes with testtools. Replace tearDown with addCleanup, addCleanup is more resilient than tearDown. The fixtures library has excellent support for managing and cleaning tempfiles. Use it. Replace skip_ with testtools.skipTest Part of blueprint grizzly-testtools. Change-Id: I45e11bbb1ff9b31f3278d3b016737dcb7850cd98
* | Merge "UTC ISO8601 from timestamp"Jenkins2013-01-231-0/+7
|\ \
| * | UTC ISO8601 from timestampFlaper Fesp2013-01-211-0/+7
| |/ | | | | | | | | | | | | | | | | 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/+6
|/ | | | | | | | | | 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>
* Make time comparison functions accept stringsDan Smith2013-01-041-8/+30
| | | | | | | This patch makes is_older_than() and is_newer_than() accept timestamps in string format, as returned from strtime(). Change-Id: I1dbf453cc08bd8aaeb4fee2491a1e8aa74f8bee3
* Fix timezone handling in timeutils testsDan Smith2013-01-031-10/+7
| | | | | | | | | | | | | | The tests for timeutils use some canned datetime values that include timezones, and override the result of utcnow() with the same. This is not correct because the real utcnow() returns naive datetime objects, so tests that assume the contrary are incorrect. This came about because I was unable to satisfy both the oslo unit tests and the nova ones with the same code. That happened because the oslo ones override utcnow() with an invalid result, and the nova tests use the real one. Change-Id: I683818f77ce0d3e3b2f07c0326d7a7196f3346c3
* Convenience wrapper for datetime.timedelta.total_seconds()Eoghan Glynn2012-11-191-0/+7
| | | | | | | 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/+12
| | | | | | | | | | 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-0/+20
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Support for marshalling datetime while preserving microseconds.SandyWalsh2012-08-101-0/+6
| | | | | | Needed for performance measurement via "inflight" service. Change-Id: I5c1a8395b4cbc5fc0f8649b3af8130f45dd401bb
* Use strtime() in to_primitive() for datetime objs.Russell Bryant2012-07-161-0/+6
| | | | | | | | | | | This patch updates jsonutils.to_primitive() to use timeutils.strtime() to convert a datimetime object to a string instead of just using str(). This ensures that we can easily convert the string back to a datetime using timeutils.parse_strtime(). Required for the nova blueprint no-db-messaging. Change-Id: I725b333695930e12e2832378102514326fec639c
* Fix utcnow_ts to return UTC timestampZhongyue Luo2012-06-111-1/+4
| | | | | | | | Fixes bug #1011121 Use calendar.timegm instead of time.mktime Change-Id: Idb8d470f1ef90162641d21122699a026fa38faf1
* Add nova time util functions to timeutilsZhongyue Luo2012-06-061-10/+54
| | | | | | | | | | | | | | | | 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
* Create openstack.common.timeutils.Russell Bryant2012-04-041-0/+157
Split time related utility functions out of openstack.common.utils into a new module, timeutils. Change-Id: Ic09952cd48e0b4548e410926cc456cbd515a4e56