get total seconds that works in >2.3
This commit is contained in:
parent
c18e0cc82e
commit
cb52ad6da3
1 changed files with 1 additions and 1 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue