summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 8b9ce4734..03a6e8095 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -335,6 +335,14 @@ def utcnow():
utcnow.override_time = None
+def is_older_than(before, seconds):
+ """Return True if before is older than 'seconds'"""
+ if utcnow() - before > datetime.timedelta(seconds=seconds):
+ return True
+ else:
+ return False
+
+
def utcnow_ts():
"""Timestamp version of our utcnow function."""
return time.mktime(utcnow().timetuple())