Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions gcloud/datastore/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ def get_value_from_protobuf(pb):

if pb.value.HasField('timestamp_microseconds_value'):
microseconds = pb.value.timestamp_microseconds_value
return (datetime.utcfromtimestamp(0) +
timedelta(microseconds=microseconds))
naive = (datetime.utcfromtimestamp(0) +

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

timedelta(microseconds=microseconds))
return naive.replace(tzinfo=pytz.utc)

elif pb.value.HasField('key_value'):
return Key.from_protobuf(pb.value.key_value)
Expand Down
4 changes: 1 addition & 3 deletions gcloud/datastore/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ def test_datetime(self):
utc = datetime.datetime(2014, 9, 16, 10, 19, 32, 4375, pytz.utc)
micros = (calendar.timegm(utc.timetuple()) * 1000000) + 4375
pb = self._makePB('timestamp_microseconds_value', micros)
# self.assertEqual(self._callFUT(pb), utc) XXX
# see https://github.com/GoogleCloudPlatform/gcloud-python/issues/131
self.assertEqual(self._callFUT(pb), naive)
self.assertEqual(self._callFUT(pb), utc)

def test_key(self):
from gcloud.datastore.datastore_v1_pb2 import Property
Expand Down