Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news1.tnib.de!feed.news.tnib.de!news.tnib.de!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '*not*': 0.07; 'bug.': 0.09; 'issue:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:while': 0.09; 'windows,': 0.09; 'python': 0.11; 'bug': 0.12; 'jan': 0.12; 'suggest': 0.14; 'windows': 0.15; '(now': 0.16; 'arg': 0.16; 'clock.': 0.16; 'displaying': 0.16; 'incorrect': 0.16; 'maintainer': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:changing': 0.16; 'summarize': 0.16; 'utc,': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'app': 0.19; 'module': 0.19; 'passing': 0.19; "python's": 0.19; 'seems': 0.21; '>>>': 0.22; 'import': 0.22; 'issue.': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'example.': 0.24; 'issue,': 0.24; 'module,': 0.24; 'tracker': 0.26; 'least': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'compared': 0.30; 'said,': 0.30; '-0700,': 0.31; 'clock': 0.31; "d'aprano": 0.31; 'purely': 0.31; 'steven': 0.31; 'updated': 0.34; 'skip:d 20': 0.34; 'but': 0.35; 'really': 0.36; 'should': 0.36; 'wrong': 0.37; 'application': 0.37; 'so,': 0.37; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'pm,': 0.38; 'that,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'users': 0.40; 'skip:u 10': 0.60; 'easy': 0.60; 'manually': 0.60; 'received:173': 0.61; 'times': 0.62; 'believe': 0.68; 'eastern': 0.68; 'reads': 0.68; 'choose.': 0.84; 'earth.': 0.84; 'received:fios.verizon.net': 0.84; 'slowed': 0.84; 'traveling': 0.96; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Jan Reedy Subject: Re: Time zone changing while Win app is running Date: Wed, 03 Apr 2013 17:41:43 -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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 In-Reply-To: <57d569df-8d29-4941-945d-46e416fc7016@n2g2000yqg.googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365025321 news.xs4all.nl 6873 [2001:888:2000:d::a6]:45134 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42706 On 4/3/2013 2:46 PM, CM wrote: > On Apr 3, 7:37 am, Steven D'Aprano +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