Comment 3 for bug 1459314

Revision history for this message
gcc (chris+ubuntu-qwirx) wrote :

Replacing the tzinfo is not a good idea. Calling utctimetuple() tries to translate from local time back to UTC, but clearly does so in an invalid way, not giving pytz a chance to choose the correct offset for this period in history. Note that the str(lon_pytz) is Local Mean Time, which is solar time (early timekeeping).

See http://stackoverflow.com/questions/11473721/weird-timezone-issue-with-pytz for details.

(Pdb) lon_pytz.localize(datetime(2015, 10, 27, 12, 34, 56, 999999)).utctimetuple()
time.struct_time(tm_year=2015, tm_mon=10, tm_mday=27, tm_hour=12, tm_min=34, tm_sec=56, tm_wday=1, tm_yday=300, tm_isdst=0)

(Pdb) lon_pytz.localize(datetime(2015, 9, 27, 12, 34, 56, 999999)).utctimetuple()
time.struct_time(tm_year=2015, tm_mon=9, tm_mday=27, tm_hour=11, tm_min=34, tm_sec=56, tm_wday=6, tm_yday=270, tm_isdst=0)