Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freezetime breaks datetime.datetime.fromtimestamp(time.time()) #153

Closed
kkpattern opened this issue Sep 9, 2016 · 1 comment
Closed

freezetime breaks datetime.datetime.fromtimestamp(time.time()) #153

kkpattern opened this issue Sep 9, 2016 · 1 comment

Comments

@kkpattern
Copy link

datetime.datetime.today() should be equivalent to datetime.fromtimestamp(time.time()). However in 0.3.7 I get this result:

>>> import datetime
>>> import time
>>> from freezegun import freeze_time
>>> with freeze_time(datetime.datetime(2016, 9, 9)):
...     print datetime.datetime.today()
...     print datetime.datetime.fromtimestamp(time.time())
... 
2016-09-09 00:00:00
2016-09-09 08:00:00

It should be:

>>> import datetime
>>> import time
>>> print datetime.datetime.today(), datetime.datetime.fromtimestamp(time.time())
2016-09-09 17:36:33.659690 2016-09-09 17:36:33.659747
>>> 

It looks like something wrong with the time zone.

@spulec
Copy link
Owner

spulec commented Jan 19, 2017

Thanks for opening.

I believe this is a dupe of #89. A solution is at #136, but it hasn't been merged in yet.

I'm going to close, but feel free to reopen if you think my assessment is wrong.

@spulec spulec closed this as completed Jan 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants