Skip to content

Commit

Permalink
Merge "fix timestamps to match documented ec2 api"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Mar 15, 2012
2 parents 6c3fd5a + 6a3e22a commit bb1e383
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Authors
Expand Up @@ -119,6 +119,7 @@ Loganathan Parthipan <parthipan@hp.com>
Lorin Hochstein <lorin@nimbisservices.com>
Lvov Maxim <usrleon@gmail.com>
Mandell Degerness <mdegerne@gmail.com>
Mark McClain <mark.mcclain@dreamhost.com>
Mark McLoughlin <markmc@redhat.com>
Mark Washenberger <mark.washenberger@rackspace.com>
Maru Newby <mnewby@internap.com>
Expand Down
2 changes: 1 addition & 1 deletion nova/api/ec2/apirequest.py
Expand Up @@ -44,7 +44,7 @@ def _underscore_to_xmlcase(str):

def _database_to_isoformat(datetimeobj):
"""Return a xs:dateTime parsable string from datatime"""
return datetimeobj.strftime("%Y-%m-%dT%H:%M:%SZ")
return datetimeobj.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3] + 'Z'


class APIRequest(object):
Expand Down
4 changes: 2 additions & 2 deletions nova/tests/test_api.py
Expand Up @@ -242,14 +242,14 @@ def test_return_valid_isoformat(self):
"%Y-%m-%d %H:%M:%S.%f")
self.assertEqual(
conv(time_to_convert),
'2011-02-21T20:14:10Z')
'2011-02-21T20:14:10.634Z')
# mysqlite database representation
time_to_convert = datetime.datetime.strptime(
"2011-02-21 19:56:18",
"%Y-%m-%d %H:%M:%S")
self.assertEqual(
conv(time_to_convert),
'2011-02-21T19:56:18Z')
'2011-02-21T19:56:18.000Z')

def test_xmlns_version_matches_request_version(self):
self.expect_http(api_version='2010-10-30')
Expand Down

0 comments on commit bb1e383

Please sign in to comment.