[Python-au] time module wierdness on windows7 with python-2.6.2

raf raf at raf.org
Mon Jul 23 10:13:23 UTC 2012


Warwick Prince wrote:

> Hi
> 
> Have you checked your Windows time zone and location settings?  May
> have been trashed in the upgrade?  Maybe change to another and the
> back to Dtdney again and the test Python's view.
> 
> Cheers
> Warwick
> 
> Warwick A. Prince
> Mushroom Systems International Pty. Ltd.

all machines have the right time zone (Australia/Sydney).
i'll try changing it to something else and back again but
it sounds unlikely.

cheers,
raf

> On 23/07/2012, at 4:36 PM, raf <raf at raf.org> wrote:
> 
> > hi,
> > 
> > i've just noticed the following wierdness with the time module
> > (python-2.6.2) on three windows7 hosts and one windowsxp host
> > (but not another xp host) and i'm wondering if anyone else has
> > encountered this and knows how to fix it.
> > 
> > the first problem is that time.timezone contains 0 instead of
> > the usual -36000 (for sydney).
> > 
> > the second problem is that time.localtime(...).is_dst is wrong.
> > time.tzname is also wrong but i care less about that.
> > 
> > the demonstration code and output is below. i can fake the
> > time.timezone being absent but i can't see any good way to
> > deal with localtime not knowing when it's daylight savings.
> > 
> > this all worked before the upgrades to windows7 (even though
> > there is one xp host where it isn't working anymore - i don't
> > know what makes the two xp hosts different).
> > 
> > any help would be appreciated.
> > 
> > cheers,
> > raf
> > 
> > #!/usr/bin/env python
> > import sys, time
> > print('sys.platform = %r' % sys.platform)
> > print('time.timezone = %r (should be -36000)' % time.timezone)
> > print('time.tzname = %r (should be (\'EST\', \'EST\' or similar))' % (time.tzname,))
> > print('dst in june = %r (should be 0 (for Australia/Sydney))' % time.localtime(time.mktime((2012, 6, 1, 0, 0, 0, 0, 0, -1))).tm_isdst)
> > print('dst in december = %r (should be 1 (for Australia/Sydney))' % time.localtime(time.mktime((2012, 12, 1, 0, 0, 0, 0, 0, -1))).tm_isdst)
> > 
> > # Max OS X 10.6.8 (correct)
> > # sys.platform = 'darwin'
> > # time.timezone = -36000 (should be -36000)
> > # time.tzname = ('EST', 'EST') (should be ('EST', 'EST') or similar)
> > # dst in june = 0 (should be 0 (for Australia/Sydney))
> > # dst in december = 1 (should be 1 (for Australia/Sydney))
> > 
> > # debian-6.0 (correct)
> > # sys.platform = 'linux2'
> > # time.timezone = -36000 (should be -36000)
> > # time.tzname = ('EST', 'EST') (should be ('EST', 'EST') or similar)
> > # dst in june = 0 (should be 0 (for Australia/Sydney))
> > # dst in december = 1 (should be 1 (for Australia/Sydney))
> > 
> > # Windows XP Professional Service Pack 3 (correct)
> > # sys.platform = 'win32'
> > # time.timezone = -36000 (should be -36000)
> > # time.tzname = ('AUS Eastern Standard Time', 'AUS Eastern Daylight Time') (should be ('EST', 'EST') or similar)
> > # dst in june = 0 (should be 0 (for Australia/Sydney))
> > # dst in december = 1 (should be 1 (for Australia/Sydney))
> > 
> > # Windows 7 and Windows XP Professional Service Pack 3 (incorrect)
> > # sys.platform = 'win32'
> > # time.timezone = 0 (should be -36000)
> > # time.tzname = ('Aus', 'tra') (should be ('EST', 'EST') or similar)
> > # dst in june = 1 (should be 0 (for Australia/Sydney))
> > # dst in december = 0 (should be 1 (for Australia/Sydney))
> > 
> > 
> > _______________________________________________
> > python-au maillist  -  python-au at starship.python.net
> > http://starship.python.net/mailman/listinfo/python-au



More information about the python-au mailing list