Issue1198275
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.
Created on 2005-05-09 13:14 by jdalambert, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (8) | |||
---|---|---|---|
msg25254 - (view) | Author: David Lambert (jdalambert) | Date: 2005-05-09 13:14 | |
Running on Fedora Core 3 Linux Consider the simple program import time while 1: print time.localtime() time.sleep(1) The tuple printed by this program does not reflect any change in the system timezone until the interpreter is exited and restarted. Using reload(time) does not fix the problem. Are there any workarounds? |
|||
msg25255 - (view) | Author: Raymond Hettinger (rhettinger) * | Date: 2005-05-10 03:09 | |
Logged In: YES user_id=80475 Brett, are you still in the time business? |
|||
msg25256 - (view) | Author: Brett Cannon (brett.cannon) * | Date: 2005-05-10 23:07 | |
Logged In: YES user_id=357491 David, how did you change the timezone? And did you call time.tzset()? If you didn't call time.tzset(), that's the problem. If you did, then there is a bug. |
|||
msg25257 - (view) | Author: Brett Cannon (brett.cannon) * | Date: 2005-05-10 23:10 | |
Logged In: YES user_id=357491 Wait, I just noticed after I sent my follow-up that this bug report is against Python 2.2.3 . You won't find time.tzset() that far back. The issue is that you need to use time.tzset() to reset the timezone for the C library functions to use any change you have made since they cache information internally. I am closing this as "won't fix" since it has been resolved in later versions and 2.2 is too old to bother backporting for. |
|||
msg25258 - (view) | Author: David Lambert (jdalambert) | Date: 2005-05-11 02:33 | |
Logged In: YES user_id=845425 Ouch! I don't know how I got 2.2.3 on the bug report? My version of Python is 2.3.4. Sorry for the confusion.:-( Let me explain further. The problem is that I have a Python script that is run as a daemon and uses localtime(). If another program (outside of my control) changes the timezone, the my daemon gets the local time according to the original timezone. Do I have to periodically poll to see if the timezone has changed? That seems somewhat inelegant. |
|||
msg25259 - (view) | Author: Brett Cannon (brett.cannon) * | Date: 2005-05-11 20:35 | |
Logged In: YES user_id=357491 OK, fixed the version and reopened this. No, you don't need to poll, just call time.tzset() before you call time.localtime() or anything else that relies on the timezone. It isn't that expensive of a call. Post here if that fixes it or not. And in terms of inelegance, the only other solution is to implicitly call time.tzset() internally for all time functions. This is an issue imposed by the ISO C libraries. |
|||
msg25260 - (view) | Author: David Lambert (jdalambert) | Date: 2005-05-13 19:07 | |
Logged In: YES user_id=845425 Yes that worked fine thanks. I guess I just had not been Reading The (updated) Fine Manual :-( |
|||
msg25261 - (view) | Author: Brett Cannon (brett.cannon) * | Date: 2005-05-13 21:04 | |
Logged In: YES user_id=357491 Cool, glad it worked out. Closed as invalid. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:11 | admin | set | github: 41965 |
2005-05-09 13:14:50 | jdalambert | create |