report at bugs
Jul 3, 2012, 10:16 AM
Post #11 of 14
Vinay Sajip <vinay_sajip [at] yahoo> added the comment:
Yes, thanks for doing the detailed analysis. I see that the original code was trying to adjust the timezone for a past time effectively using current timezone rules, which is why it doesn't work.
Your patch appears equivalent to the slightly simpler
dt = datetime.datetime(1993, 4, 21, 8, 3, 0, 0, utc)
r.created = time.mktime(dt.astimezone(None).timetuple())
which echoes the intent of the original code to adjust for the timezone. Can you see any reason why the above shouldn't work? On my test machine, it worked fine with the above code and locations of Moscow, London and Caracas (the original code failed with Caracas, though not with Moscow - but do I understand that the original is broken).
Python tracker <report [at] bugs>
Python-bugs-list mailing list