get total seconds that works in >2.3

This commit is contained in:
Clint Ecker 2014-06-20 16:14:22 -05:00
parent c18e0cc82e
commit cb52ad6da3

View File

@ -13,7 +13,7 @@ def unix_time(dt=None):
dt = dt or datetime.datetime.utcnow()
epoch = datetime.datetime.utcfromtimestamp(0)
delta = dt - epoch
return delta.total_seconds()
return (delta.days * 86400) + (delta.seconds + (delta.microseconds / 1e6))
def unix_time_millis(dt=None):