How to determine whether the OS has the latest DST rules
Dave Cantor
Dave at Cantor.mv.com
Fri Nov 7 02:30:45 UTC 2008
On 06-Nov-2008, Nicolas Alvarez wrote:
> yoshito_umaoka at us.ibm.com wrote:
> > To access time zone rules used by Windows, you can use the API
> > below -
> http://msdn.microsoft.com/en-us/library/system.timezoneinfo.getadj
> ustmentrules.aspx
> Any way without .NET?
Yup. Here's a start:
dosprompt> REG QUERY
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Time Zones\Eastern Standard Time"
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Time Zones\Eastern Standard Time
Display REG_SZ (GMT-05:00) Eastern Time (US & Canada)
Dlt REG_SZ Eastern Daylight Time
Std REG_SZ Eastern Standard Time
MapID REG_SZ 38,39
Index REG_DWORD 0x23
TZI REG_BINARY
2C01000000000000C4FFFFFF00000B000000010002000000000000000000030000
0002000200000000000000
You can decode the item TZI.
2C01000000000000C4FFFFFF00000B000000010002000000000000000000030000
0002000200000000000000
First there are three 32-bit numbers:
as shown reverse bytes translate
2C010000 --> 0000012c --> 300 minutes offset from UTC
00000000 00000000 --> 0 std time offset
C4FFFFFF ffffffc4 --> -60 dst offset
That is timezone offset is 300 minutes;
offset for standard time is 300 minutes;
offset for daylight time is (300 - 60) = 240 minutes
Then there are two 28-byte SYSTEMTIME structures
00000B00000001000200000000000000
00000300000002000200000000000000
The first is the change date to standard time
The second is the change date to daylight time
0000 0B00 0000 0100 0200 0000 0000 0000 < ch to std tim
0000 0300 0000 0200 0200 0000 0000 0000 < ch to dst
yr mon dow day hr min sec msec
For each item reverse the bytes.
0 0b 0 01 02 0 0 0
0 03 0 02 02 0 0 0
Year is always 0
This says change to standard time on the first Sunday in November
at 02:00:00.000 and change to daylight time on the second Sunday
in March at 02:00:00.000 .
I hope this helps you.
Dave C.
More information about the tz
mailing list