Skip to content

Commit

Permalink
Merge pull request #1029 from dhermes/fix-nondeterministic-bigquery-test
Browse files Browse the repository at this point in the history
Fixes a non-deterministic failing test in bigquery.
  • Loading branch information
dhermes committed Aug 4, 2015
2 parents 2928bfc + 742bd08 commit 777c6ac
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gcloud/bigquery/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ def _datetime_from_prop(value):
"""
if value is not None:
# back-end returns timestamps as milliseconds since the epoch
value = datetime.datetime.utcfromtimestamp(value / 1000.0)
return value.replace(tzinfo=pytz.utc)
seconds = int(value / 1000.0)
microseconds = 1000.0 * (value - 1000 * seconds)
return (
_EPOCH +
datetime.timedelta(seconds=seconds, microseconds=microseconds)
)


def _prop_from_datetime(value):
Expand Down

0 comments on commit 777c6ac

Please sign in to comment.