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

Fix inconsistency between timestamp and strftime #356

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mkarys
Copy link

@mkarys mkarys commented Jun 27, 2020

It fixes #343

@coveralls
Copy link

Coverage Status

Coverage decreased (-4.3%) to 89.068% when pulling 7df9a78 on mkarys:fix-strftime into a57f61f on spulec:master.

@boxed
Copy link
Contributor

boxed commented Jun 28, 2020

I'm confused about the test... doesn't this test basically do nothing if run on a system with UTC as local time zone?

The test is very elegant, but it seems like it relies on a misfeature of freezegun.. or am I misunderstanding?

@mkarys
Copy link
Author

mkarys commented Jun 29, 2020

@boxed yes, you right, it fixes cases that UTC is not local time zone, if UTC is local time zone it was okay without it.
What misfeature of freezegun are you refer to?

@pganssle
Copy link
Contributor

I don't think this is the right solution. It fixes the problem with "%s" but breaks strftime in general.

For example, running this with TZ='America/New_York':

import freezegun
from datetime import datetime

with freezegun.freeze_time("1970-01-01T00:00"):
    print(datetime(2010, 1, 1).strftime("%Y-%m-%dT%H:%M:%S"))
    # 2009-12-31T19:00:00

print(datetime(2010, 1, 1).strftime("%Y-%m-%dT%H:%M:%S"))
# 2010-01-01T00:00:00

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

Successfully merging this pull request may close these issues.

v0.3.15 | Inconsistency between timestamp and strftime
4 participants