[New-bugs-announce] [issue5582] Incorrect DST transition on Windows

acummings report at bugs.python.org
Sat Mar 28 00:23:38 CET 2009


New submission from acummings <acummings at aperiogroup.com>:

On Windows, the calculation of when DST starts is incorrect. Windows OS 
seems to be fully patched, and correctly changed to DST on 3-8-2009. 
However, datetime.now() is 1 hour less then Windows displayed time.

I even tried setting the TZ environment variable to 
PST8PDT,M3.2.0,M11.1.0 to fully specify the date change.

Below you can see that today (3-27-08) is marked as standard time, while 
July 1st is DST and Jan 1st is Standard, if I understand the meaning of 
the 9th element of the timetuple:

ON WINDOWS, with windows reporting the time as 3:59pm:
>>> july1 = datetime(2009, 7, 1)
>>> jan1 = datetime(2009, 1, 1)
>>> time.localtime(time.mktime(july1.timetuple()))
(2009, 7, 1, 0, 0, 0, 2, 182, 1)
>>> time.localtime(time.mktime(jan1.timetuple()))
(2009, 1, 1, 0, 0, 0, 3, 1, 0)
>>> time.localtime(time.mktime(datetime.now().timetuple()))
(2009, 3, 27, 14, 59, 46, 4, 86, 0)

It worked correctly on Linux, though: 
>>> july1 = datetime(2009,7,1)
>>> jan1 = datetime(2009,1,1)
>>> time.localtime(time.mktime(july1.timetuple()))
(2009, 7, 1, 0, 0, 0, 2, 182, 1)
>>> time.localtime(time.mktime(jan1.timetuple()))
(2009, 1, 1, 0, 0, 0, 3, 1, 0)
>>> time.localtime(time.mktime(datetime.now().timetuple()))
(2009, 3, 27, 15, 57, 2, 4, 86, 1)

----------
components: Windows
messages: 84286
nosy: acummings
severity: normal
status: open
title: Incorrect DST transition on Windows
versions: Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5582>
_______________________________________


More information about the New-bugs-announce mailing list