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:

committed by
mdavidsaver

parent
2e51578ec8
commit
4269c69c23
@ -254,6 +254,8 @@ class Record(_dbapi._Record):
|
|||||||
"""
|
"""
|
||||||
if hasattr(ts, 'timetuple'):
|
if hasattr(ts, 'timetuple'):
|
||||||
ts = time.mktime(ts.timetuple())
|
ts = time.mktime(ts.timetuple())
|
||||||
|
if hasattr(ts, 'timestamp'):
|
||||||
|
ts = ts.timestamp()
|
||||||
if isinstance(ts, float):
|
if isinstance(ts, float):
|
||||||
sec, nsec = int(ts), int(ts*1e9)%1000000000
|
sec, nsec = int(ts), int(ts*1e9)%1000000000
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user