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.

classification
Title: Windows timezone changes not reflected by time.localtime
Type: behavior Stage: resolved
Components: Library (Lib), Windows Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: brian.curtin, ericpruitt, loewis
Priority: normal Keywords:

Created on 2010-12-05 23:57 by ericpruitt, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg123442 - (view) Author: Eric Pruitt (ericpruitt) * Date: 2010-12-05 23:57
If the current time zone changes on Windows, time.localtime will continue to return results that reflect the time zone the system used when the module was imported. My current work around is to use GetLocalTime from kernel32 with ctypes. Windows does not have a tzset() equivalent as it does in Linux, but it seems like modifying time.localtime to use GetLocalTime on Windows systems could make up for this shortcoming.
msg123446 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-12-06 00:25
This is not a bug in Python, but in the Microsoft CRT. Rewriting Python to not use the CRT anymore for this is non-trivial, in particular as the semantics of environment variables (TZ) needs to be considered.
msg123472 - (view) Author: Eric Pruitt (ericpruitt) * Date: 2010-12-06 15:55
Is there a way to force the time module to be reinitialized? I had no success experimenting with reload and del, but I assume that has something to do with the module being CRT based.
msg123487 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-12-06 18:41
What needs reinitialization is not the time module, but the CRT. This is not possible without starting a completely new process.
History
Date User Action Args
2022-04-11 14:57:09adminsetgithub: 54843
2010-12-13 17:48:22r.david.murraysetresolution: not a bug
stage: test needed -> resolved
2010-12-12 19:37:14ericpruittsetstatus: open -> closed
2010-12-06 18:41:37loewissetmessages: + msg123487
2010-12-06 15:55:37ericpruittsetmessages: + msg123472
2010-12-06 15:43:20brian.curtinsetnosy: + brian.curtin
2010-12-06 00:25:54loewissetnosy: + loewis
messages: + msg123446
2010-12-05 23:58:33brian.curtinsetstage: test needed
components: + Library (Lib)
versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6, Python 2.5
2010-12-05 23:57:22ericpruittcreate