ANN: pytz-2004b World timezone library
tim.peters at gmail.com
Thu Jul 22 03:28:08 CEST 2004
> Note that if you perform date arithmetic on local times that cross DST
> boundaries, the results may be in an incorrect timezone (ie. subtract
> 1 minute from 2002-10-27 1:00 EST and you get 2002-10-27 0:59 EST
> instead of the correct 2002-10-27 1:59 EDT). This cannot be resolved without
> modifying the Python datetime implementation.
That's unlikely to happen. As designed and documented, datetime
module arithmetic within a single timezone is "naive" arithmetic,
based on Guido's belief that most users most of the time find that
most useful. The intended way to trip over daylight quirks *when
desired* is to convert to UTC first, do arithmetic in UTC, then
convert back from UTC.
> However, these tzinfo classes provide a normalize() method which allows
> you to correct these values.
That's another idea <wink>.
Thank you for doing this! I know it's a messy and mostly thankless task.
More information about the Python-list