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 DST issues surrounding calls to datetime.now() #149

Open
dlareau opened this issue Nov 1, 2020 · 2 comments
Open

Fix DST issues surrounding calls to datetime.now() #149

dlareau opened this issue Nov 1, 2020 · 2 comments
Labels
bug Easy Easy to implement

Comments

@dlareau
Copy link
Owner

dlareau commented Nov 1, 2020

Last night between 1am and 1am (I don't know how to properly describe the repeated hour) we encountered 335 instances of AmbiguousTimeError mostly seeming to stem from calls to datetime.now(). Some googling seems to imply we need to also include a call to make_aware. No huge rush on this issue though, presumably only happens once a year.

@timparenti
Copy link
Contributor

Did these arise between 01:00 EDT and 01:59 EDT (0500–0559 UTC), or between 01:00 EST and 01:59 EST (0600–0659 UTC)?

@dlareau
Copy link
Owner Author

dlareau commented Nov 1, 2020

Heh, I knew I could rely on a response from you :)
Digging into the logs further it appears the errors actually occurred in the whole two hour span of 0500-0700 UTC.

The problem simply seems to be that python has two datetime types, "naive" and "timzezone aware", and if you try and do any comparisons to a naive timestamp that falls in the DST fallback period python (probably correctly) errors rather than attempt to make a guess at what you meant. Hence the necessary calls to "make_aware".

@dlareau dlareau added bug Easy Easy to implement labels Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Easy Easy to implement
Projects
None yet
Development

No branches or pull requests

2 participants