Skip to content
Merged
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
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