devsup.db: Record.setTime() accept float
This commit is contained in:
@ -254,12 +254,10 @@ class Record(_dbapi._Record):
|
|||||||
"""
|
"""
|
||||||
if hasattr(ts, 'timetuple'):
|
if hasattr(ts, 'timetuple'):
|
||||||
ts = time.mktime(ts.timetuple())
|
ts = time.mktime(ts.timetuple())
|
||||||
|
elif isinstance(ts, float):
|
||||||
try:
|
sec, nsec = int(ts), int(ts*1e9)%1000000000
|
||||||
|
else:
|
||||||
sec, nsec = ts
|
sec, nsec = ts
|
||||||
except TypeError:
|
|
||||||
sec = int(ts)
|
|
||||||
nsec = int(ts*1e9)%1000000000
|
|
||||||
|
|
||||||
super(Record, self).setTime(sec, nsec)
|
super(Record, self).setTime(sec, nsec)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user