diff options
Diffstat (limited to 'openstack/common/timeutils.py')
-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()) |