diff options
author | Jenkins <jenkins@review.openstack.org> | 2012-10-11 15:25:43 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2012-10-11 15:25:43 +0000 |
commit | fda069b557f6e432b62021db5244e8fdbda42551 (patch) | |
tree | cae5d425395c51c7a895725d94a29b86cf50735d /openstack | |
parent | 8b585cb969a823246a36d5b2cc7eac725e378fca (diff) | |
parent | 85bed287461036745afe6a4c623e546c52641b1e (diff) | |
download | oslo-fda069b557f6e432b62021db5244e8fdbda42551.tar.gz oslo-fda069b557f6e432b62021db5244e8fdbda42551.tar.xz oslo-fda069b557f6e432b62021db5244e8fdbda42551.zip |
Merge "Added is_newer_than function"
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 93b34fc..8600439 100644 --- a/openstack/common/timeutils.py +++ b/openstack/common/timeutils.py @@ -74,6 +74,11 @@ def is_older_than(before, seconds): return utcnow() - before > datetime.timedelta(seconds=seconds) +def is_newer_than(after, seconds): + """Return True if after is newer than seconds.""" + return after - utcnow() > datetime.timedelta(seconds=seconds) + + def utcnow_ts(): """Timestamp version of our utcnow function.""" return calendar.timegm(utcnow().timetuple()) |