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).
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(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)
time.struct_
(Pdb) lon_pytz. localize( datetime( 2015, 9, 27, 12, 34, 56, 999999) ).utctimetuple( ) 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)
time.struct_