From 4269c69c23c972590e27aae6755aa4b709394bc3 Mon Sep 17 00:00:00 2001 From: Philipp Niedermayer Date: Mon, 16 Apr 2018 13:52:41 +0200 Subject: [PATCH] Use datetime.timestamp() Includes nanoseconds and is timezone independend Available from python 3.3 (older versions will still use timetuple) --- devsupApp/src/devsup/db.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devsupApp/src/devsup/db.py b/devsupApp/src/devsup/db.py index 5d6a316..2197902 100644 --- a/devsupApp/src/devsup/db.py +++ b/devsupApp/src/devsup/db.py @@ -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: