summaryrefslogtreecommitdiffstats
path: root/nova/context.py
diff options
context:
space:
mode:
authorZhongyue Luo <lzyeval@gmail.com>2012-06-06 10:32:49 +0800
committerZhongyue Luo <lzyeval@gmail.com>2012-06-16 07:17:01 +0800
commit9ff3121bd90133fb3b37c0e10407b5f7ade26b90 (patch)
tree9c3d48c0b49f89374813c23dc49bc7ded34ed414 /nova/context.py
parentfb9abcc83935b01746aeba0db4c431fe72b921fc (diff)
downloadnova-9ff3121bd90133fb3b37c0e10407b5f7ade26b90.tar.gz
nova-9ff3121bd90133fb3b37c0e10407b5f7ade26b90.tar.xz
nova-9ff3121bd90133fb3b37c0e10407b5f7ade26b90.zip
Replaces functions in utils.py with openstack/common/timeutils.py
Fixes bug #1008628 1. Edit openstack-common.conf and import nova/openstack/common/timeutils.py 2. Move time related functions from utils.py to timeutils.py 3. Replace following functions in utils.py with timeutils.py - isotime - parse_isotime - strtime - parse_strtime - normalize_time - is_older_than - utcnow_ts - utcnow - set_time_override - advance_time_delta - advance_time_seconds - clear_time_override 4. Remove datetime related functions and datetime related unittests Change-Id: I9a92be286fb071b6237dd39495d88dae106e2ce0
Diffstat (limited to 'nova/context.py')
-rw-r--r--nova/context.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/nova/context.py b/nova/context.py
index 2b97b0f54..f2bb6b5d6 100644
--- a/nova/context.py
+++ b/nova/context.py
@@ -23,6 +23,7 @@ import copy
from nova import log as logging
from nova.openstack.common import local
+from nova.openstack.common import timeutils
from nova import utils
@@ -71,9 +72,9 @@ class RequestContext(object):
self.read_deleted = read_deleted
self.remote_address = remote_address
if not timestamp:
- timestamp = utils.utcnow()
+ timestamp = timeutils.utcnow()
if isinstance(timestamp, basestring):
- timestamp = utils.parse_strtime(timestamp)
+ timestamp = timeutils.parse_strtime(timestamp)
self.timestamp = timestamp
if not request_id:
request_id = generate_request_id()
@@ -115,7 +116,7 @@ class RequestContext(object):
'read_deleted': self.read_deleted,
'roles': self.roles,
'remote_address': self.remote_address,
- 'timestamp': utils.strtime(self.timestamp),
+ 'timestamp': timeutils.strtime(self.timestamp),
'request_id': self.request_id,
'auth_token': self.auth_token,
'quota_class': self.quota_class,