Use datetime.timestamp()

Includes nanoseconds and is timezone independend
Available from python 3.3 (older versions will still use timetuple)
This commit is contained in:
Philipp Niedermayer
2018-04-16 13:52:41 +02:00
committed by mdavidsaver
parent 2e51578ec8
commit 4269c69c23

View File

@ -254,6 +254,8 @@ class Record(_dbapi._Record):
"""
if hasattr(ts, 'timetuple'):
ts = time.mktime(ts.timetuple())
if hasattr(ts, 'timestamp'):
ts = ts.timestamp()
if isinstance(ts, float):
sec, nsec = int(ts), int(ts*1e9)%1000000000
else: