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

raf raf at raf.org
Mon Jul 23 10:16:36 UTC 2012


Mark Hammond wrote:

> FWIW, there is a python-win32 at python.org mailing list which might be
> better for windows specific questions,

but this has nothing to do with the win32 modules,
just the standard time module. but i'll try that.

> but one thing you don't
> mention is what the timezone settings are in Control Panel - that is
> the first place I'd be looking.

that was the first thing i checked :)
they're all Australia/Sydney

> FWIW, my windows 7 box is showing
> the correct values (-36000 for timezone, ('AUS Eastern Standard
> Time', 'AUS Eastern Daylight Time') for tzname and the correct
> values for your tz_isdst examples - I'm in Melb.)

so it's just me then :)

> HTH,
> Mark

cheers,
raf

> On 23/07/2012 4:36 PM, raf 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