Skip to content

Commit

Permalink
Fix utc time calculation if provided datetime has tz info (#1287)
Browse files Browse the repository at this point in the history
  • Loading branch information
labeneator authored and mistercrunch committed Oct 14, 2016
1 parent 82bcadf commit 65c744f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions caravel/utils.py
Expand Up @@ -10,6 +10,7 @@
import functools
import json
import logging
import pytz
import numpy
import signal
import uuid
Expand Down Expand Up @@ -368,6 +369,9 @@ def json_iso_dttm_ser(obj):


def datetime_to_epoch(dttm):
if dttm.tzinfo:
epoch_with_tz = pytz.utc.localize(EPOCH)
return (dttm - epoch_with_tz).total_seconds() * 1000
return (dttm - EPOCH).total_seconds() * 1000


Expand Down

0 comments on commit 65c744f

Please sign in to comment.