diff options
| author | Todd Willey <todd@ansolabs.com> | 2010-07-26 17:00:50 -0400 |
|---|---|---|
| committer | Todd Willey <todd@ansolabs.com> | 2010-07-26 17:00:50 -0400 |
| commit | fd2d4e3f3dba426eedc22b326d2bb0cb6a19eb76 (patch) | |
| tree | 2d1f8c47bbc995e71eb4a32003bad424e39f11da /nova/utils.py | |
| parent | d6e74751fa156f3879ff2136caccf2a40d4b9e8c (diff) | |
| download | nova-fd2d4e3f3dba426eedc22b326d2bb0cb6a19eb76.tar.gz nova-fd2d4e3f3dba426eedc22b326d2bb0cb6a19eb76.tar.xz nova-fd2d4e3f3dba426eedc22b326d2bb0cb6a19eb76.zip | |
Expiry awareness for SessionToken.
Diffstat (limited to 'nova/utils.py')
| -rw-r--r-- | nova/utils.py | 9 |
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) |
