This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cm
Recipients cm
Date 2013-04-03.18:39:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1365014351.49.0.143463684024.issue17627@psf.upfronthosting.co.za>
In-reply-to
Content
On Windows (tested on XP), the datetime module (and, as reported online in [1], time module) apparently gets the timezone only when a Python instance first starts, but then never updates the timezone during the life of that Python instance.  So, if the user changes the system time zone while an application is running, datetime still uses the time zone that the Python instance started with, and so it is incorrect.

Example, Python 2.7.3:

First, the system time zone is set to Eastern U.S. and the system time shows 14:27.

>>> import datetime
>>> print datetime.datetime.now()
2013-04-03 14:27:43.124000

This is correct, and matches the system clock.

Now user changes time zone on Windows to GMT (and doesn't change the time).  Clock now shows the time as 18:29.

>>> print datetime.datetime.now()
2013-04-03 14:29:02.875000
            ^
This is incorrect and doesn't match the time shown on the system clock.

Note:  if the user changes the system clock time and NOT the time zone, then datetime updates the time fine.  

This has been discussed in a Stack Overflow question, with a proposed workaround[1], but it doesn't fix the fact that this makes datetime incorrect for those that have processes that ought to continue across time zone changes as the user moves.

[1]See accepted answer in particular here:  http://stackoverflow.com/questions/4360981/make-python-respond-to-windows-timezone-changes
History
Date User Action Args
2013-04-03 18:39:11cmsetrecipients: + cm
2013-04-03 18:39:11cmsetmessageid: <1365014351.49.0.143463684024.issue17627@psf.upfronthosting.co.za>
2013-04-03 18:39:11cmlinkissue17627 messages
2013-04-03 18:39:11cmcreate