summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorJosh Kearney <josh@jk0.org>2011-03-23 23:16:46 -0500
committerJosh Kearney <josh@jk0.org>2011-03-23 23:16:46 -0500
commit2f6aff324009be63ad2368295d5af01dcd040c4d (patch)
tree4bd93aee816759216c04b1320a0fed103c021473 /nova/utils.py
parent90ce5030c29274e63d45b34ec1e50b0078c63b2f (diff)
parentaf22892a2b1dc413f7d11c2f6efe2f820e3257ed (diff)
downloadnova-2f6aff324009be63ad2368295d5af01dcd040c4d.tar.gz
nova-2f6aff324009be63ad2368295d5af01dcd040c4d.tar.xz
nova-2f6aff324009be63ad2368295d5af01dcd040c4d.zip
Merged trunk
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())