Issue 10634: Windows timezone changes not reflected by time.localtime (original) (raw)

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:09 admin set github: 54843
2010-12-13 17:48:22 r.david.murray set resolution: not a bugstage: test needed -> resolved
2010-12-12 19:37:14 ericpruitt set status: open -> closed
2010-12-06 18:41:37 loewis set messages: +
2010-12-06 15:55:37 ericpruitt set messages: +
2010-12-06 15:43:20 brian.curtin set nosy: + brian.curtin
2010-12-06 00:25:54 loewis set nosy: + loewismessages: +
2010-12-05 23:58:33 brian.curtin set stage: test neededcomponents: + Library (Lib)versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6, Python 2.5
2010-12-05 23:57:22 ericpruitt create