summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorEwan Mellor <ewan.mellor@citrix.com>2010-07-29 00:11:02 +0100
committerEwan Mellor <ewan.mellor@citrix.com>2010-07-29 00:11:02 +0100
commit9f4996e8738991a95a23cba2caa660f7002f94cd (patch)
treee40bc2e56ea96131200d5e12918bf5a429bb5cc1 /nova/utils.py
parentc5edaa2186add12947185cb1fd47e0a48eccafa9 (diff)
parentf61b62983f62aa10d7bed3bc1c406717663be923 (diff)
Merge with trunk, including fixing up conflicts with the removal of fake_users
and the reworking of node.py -> service.py.
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 9ecceafe0..a1eb0a092 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -20,7 +20,7 @@
System-level utilities and helper functions.
"""
-from datetime import datetime
+from datetime import datetime, timedelta
import inspect
import logging
import os
@@ -32,7 +32,7 @@ import sys
from nova import flags
FLAGS = flags.FLAGS
-
+TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
def fetchfile(url, target):
logging.debug("Fetching %s" % url)
@@ -118,4 +118,7 @@ def get_my_ip():
def isotime(at=None):
if not at:
at = datetime.utcnow()
- return at.strftime("%Y-%m-%dT%H:%M:%SZ")
+ return at.strftime(TIME_FORMAT)
+
+def parse_isotime(timestr):
+ return datetime.strptime(timestr, TIME_FORMAT)