puzzlehunt_server
puzzlehunt_server copied to clipboard
Fix DST issues surrounding calls to datetime.now()
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.
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)?
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".