Fix utc time calculation if provided datetime has tz info (#1287)
This commit is contained in:
parent
82bcadf7f8
commit
65c744f242
|
|
@ -10,6 +10,7 @@ import decimal
|
||||||
import functools
|
import functools
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import pytz
|
||||||
import numpy
|
import numpy
|
||||||
import signal
|
import signal
|
||||||
import uuid
|
import uuid
|
||||||
|
|
@ -368,6 +369,9 @@ def json_iso_dttm_ser(obj):
|
||||||
|
|
||||||
|
|
||||||
def datetime_to_epoch(dttm):
|
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
|
return (dttm - EPOCH).total_seconds() * 1000
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue