Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows timezone changes not reflected by time.localtime #54843

Closed
ericpruitt mannequin opened this issue Dec 5, 2010 · 4 comments
Closed

Windows timezone changes not reflected by time.localtime #54843

ericpruitt mannequin opened this issue Dec 5, 2010 · 4 comments
Labels
OS-windows stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@ericpruitt
Copy link
Mannequin

ericpruitt mannequin commented Dec 5, 2010

BPO 10634
Nosy @loewis, @briancurtin

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2010-12-12.19:37:14.274>
created_at = <Date 2010-12-05.23:57:22.853>
labels = ['invalid', 'type-bug', 'library', 'OS-windows']
title = 'Windows timezone changes not reflected by time.localtime'
updated_at = <Date 2010-12-13.17:48:22.106>
user = 'https://bugs.python.org/ericpruitt'

bugs.python.org fields:

activity = <Date 2010-12-13.17:48:22.106>
actor = 'r.david.murray'
assignee = 'none'
closed = True
closed_date = <Date 2010-12-12.19:37:14.274>
closer = 'ericpruitt'
components = ['Library (Lib)', 'Windows']
creation = <Date 2010-12-05.23:57:22.853>
creator = 'ericpruitt'
dependencies = []
files = []
hgrepos = []
issue_num = 10634
keywords = []
message_count = 4.0
messages = ['123442', '123446', '123472', '123487']
nosy_count = 3.0
nosy_names = ['loewis', 'brian.curtin', 'ericpruitt']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue10634'
versions = ['Python 3.1', 'Python 2.7', 'Python 3.2']

@ericpruitt
Copy link
Mannequin Author

ericpruitt mannequin commented Dec 5, 2010

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.

@ericpruitt ericpruitt mannequin added OS-windows type-bug An unexpected behavior, bug, or error labels Dec 5, 2010
@briancurtin briancurtin added the stdlib Python modules in the Lib dir label Dec 5, 2010
@loewis
Copy link
Mannequin

loewis mannequin commented Dec 6, 2010

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.

@ericpruitt
Copy link
Mannequin Author

ericpruitt mannequin commented Dec 6, 2010

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.

@loewis
Copy link
Mannequin

loewis mannequin commented Dec 6, 2010

What needs reinitialization is not the time module, but the CRT. This is not possible without starting a completely new process.

@ericpruitt ericpruitt mannequin closed this as completed Dec 12, 2010
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS-windows stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants