Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42706
| From | Terry Jan Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: Time zone changing while Win app is running |
| Date | 2013-04-03 17:41 -0400 |
| References | <65e456f0-a59d-4461-9af9-d5bb1413d91f@p5g2000yqj.googlegroups.com> <515bdc3d$0$29891$c3e8da3$5496439d@news.astraweb.com> <57d569df-8d29-4941-945d-46e416fc7016@n2g2000yqg.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.76.1365025321.3114.python-list@python.org> (permalink) |
On 4/3/2013 2:46 PM, CM wrote: > On Apr 3, 7:37 am, Steven D'Aprano <steve > +comp.lang.pyt...@pearwood.info> wrote: >> On Tue, 02 Apr 2013 17:04:12 -0700, CM wrote: >>> To summarize the issue: In an application, I have been using Python's >>> datetime module to get the current time. But it seems that, at least >>> with Windows (XP), whatever time zone your computer is set to when you >>> start the application, that's what datetime will use--the time zone will >>> *not* be updated in the application when you update it manually with >>> Windows. So, if you change the time zone (say, after traveling with >>> your laptop), all datetimes will be incorrect as compared to your system >>> clock. >> >> I am not the maintainer of the datetime module, but based purely on what >> you have said, I would consider that a bug. I don't. Do you really want every time function slowed by re-initializing the timezone? >> I suggest you report it as an issue on the Python bug tracker. I do believe that time.tzget can now be make to work now on Windows, and that would be a proper tracker issue. > > Thanks, I submitted an issue about it. On 2.7.3, on Windows, it's > easy to demonstrate: > > (Actual time = 2:40pm; tz = Eastern U.S.) > >> import datetime >> print datetime.datetime.now() > 2013-04-03 14:40:03.124000 <---- RIGHT > > (Now change time zone to UTC, for example. Now clock reads 6:41pm.) >> import datetime Without a restart, this is a no=op. >> print datetime.datetime.now() > 2013-04-03 14:41:13.124000 <---- WRONG As I said on the issue, passing a tz arg to now() will give the answer for any timezone on earth. A user-friendly app displaying times should let users choose. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Time zone changing while Win app is running CM <cmpython@gmail.com> - 2013-04-02 17:04 -0700
Re: Time zone changing while Win app is running Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-03 07:37 +0000
Re: Time zone changing while Win app is running CM <cmpython@gmail.com> - 2013-04-03 11:46 -0700
Re: Time zone changing while Win app is running CM <cmpython@gmail.com> - 2013-04-03 11:47 -0700
Re: Time zone changing while Win app is running Terry Jan Reedy <tjreedy@udel.edu> - 2013-04-03 17:41 -0400
Re: Time zone changing while Win app is running CM <cmpython@gmail.com> - 2013-04-03 22:05 -0700
csiph-web