Running Windows XP, in a Python application, I get the current time with:
import datetime
now = datetime.datetime.now()
And the time matches the time on the system clock display. However, now, with the application still running, I go to the Windows clock and select Time Zone and change it. Now I get the time again using the method above, and this time it is incorrect--it is giving me the time as though I had not changed the time zone.
But if I close the application and restart it and then get the time, then it matches the clock. It's as if it is "stuck" in whatever time zone the application loaded in first.
Interestingly, this only happens with a time zone change; if I merely change the time (and not the time zone) that change is changed in the application correctly.
Why is this and what can I do to prevent it?