Closed b1-88er closed 9 years ago
This issue is invalid. datetime.timetuple()
returns a localized timetuple. Try the following, substituting your local timezone for 'US/Pacific'.
>>> d = Delorean(datetime(2015, 1, 1), timezone='US/Pacific')
>>> d.epoch()
1420099200.0
>> time.mktime(d.datetime.timetuple())
1420099200.0
Thanks!
That in a nutshell is why I dislike datetime. :100: Thanks for the quick response there @mlew
In [57]: Delorean(datetime.now(), timezone='UTC').epoch() - time.time() Out[57]: 7199.999927997589
In [58]: time.mktime(Delorean(datetime.now(), timezone='UTC').datetime.timetuple()) - time.time() Out[58]: 3599.633516073227