Hi all, The following code snippet isn''t working terribly well for me. I can get the Bias, StandardName and DaylightName, but everything else is goofed up. The alignment seems ok, but maybe I''ve missed something or maybe I have to do extra work to unpack the SYSTEMTIME structures. require ''windows/time'' include Windows::Time buf = 0.chr * 172 # sizeof(TIME_ZONE_INFORMATION) GetTimeZoneInformation(buf) p buf[0,4].unpack(''L'')[0] # Bias p buf[4,64].tr("\0",'''') # StandardName p buf[68,2].unpack(''S'')[0] # Year p buf[70,2].unpack(''S'')[0] # Month p buf[72,2].unpack(''S'')[0] # DOW p buf[74,2].unpack(''S'')[0] # Day p buf[76,2].unpack(''S'')[0] # Hour p buf[78,2].unpack(''S'')[0] # Minute p buf[80,2].unpack(''S'')[0] # Second p buf[82,2].unpack(''S'')[0] # Millisecond p buf[84,4].unpack(''S'')[0] # StandardBias p buf[88,64].tr("\0",'''') # DaylightName p buf[152,2].unpack(''S'')[0] # Year p buf[154,2].unpack(''S'')[0] # Month p buf[156,2].unpack(''S'')[0] # DOW p buf[158,2].unpack(''S'')[0] # Day p buf[160,2].unpack(''S'')[0] # Hour p buf[162,2].unpack(''S'')[0] # Minute p buf[164,2].unpack(''S'')[0] # Second p buf[166,2].unpack(''S'')[0] # Millisecond p buf[168,4].unpack(''L'')[0] # DaylightBias Regards, Dan
Hi, 2007/10/15, Daniel Berger <djberg96 at gmail.com>:> > Hi all, > > The following code snippet isn''t working terribly well for me. I can get > the Bias, StandardName and DaylightName, but everything else is goofed > up. The alignment seems ok, but maybe I''ve missed something or maybe I > have to do extra work to unpack the SYSTEMTIME structures. > > require ''windows/time'' > include Windows::Time > > buf = 0.chr * 172 # sizeof(TIME_ZONE_INFORMATION) > GetTimeZoneInformation(buf) > > p buf[0,4].unpack(''L'')[0] # Bias > p buf[4,64].tr("\0",'''') # StandardName > p buf[68,2].unpack(''S'')[0] # Year > p buf[70,2].unpack(''S'')[0] # Month > p buf[72,2].unpack(''S'')[0] # DOW > p buf[74,2].unpack(''S'')[0] # Day > p buf[76,2].unpack(''S'')[0] # Hour > p buf[78,2].unpack(''S'')[0] # Minute > p buf[80,2].unpack(''S'')[0] # Second > p buf[82,2].unpack(''S'')[0] # Millisecond > p buf[84,4].unpack(''S'')[0] # StandardBias > p buf[88,64].tr("\0",'''') # DaylightName > p buf[152,2].unpack(''S'')[0] # Year > p buf[154,2].unpack(''S'')[0] # Month > p buf[156,2].unpack(''S'')[0] # DOW > p buf[158,2].unpack(''S'')[0] # Day > p buf[160,2].unpack(''S'')[0] # Hour > p buf[162,2].unpack(''S'')[0] # Minute > p buf[164,2].unpack(''S'')[0] # Second > p buf[166,2].unpack(''S'')[0] # Millisecond > p buf[168,4].unpack(''L'')[0] # DaylightBias > > Regards, > > DanThe SYSTEMTIME structure field StandarddDate and DaylightDate is not used with GetTimeZoneInformation API, but used with SetTimeZoneInformation. Refer to the sample vbnet code at http://vbnet.mvps.org/index.html?code/locale/gettimezoneinfo.htm Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20071015/46433d32/attachment.html
Heesob Park wrote:> > Hi, > > 2007/10/15, Daniel Berger <djberg96 at gmail.com <mailto:djberg96 at gmail.com>>: > > Hi all, > > The following code snippet isn''t working terribly well for me. I can get > the Bias, StandardName and DaylightName, but everything else is goofed > up. The alignment seems ok, but maybe I''ve missed something or maybe I > have to do extra work to unpack the SYSTEMTIME structures. > > require ''windows/time'' > include Windows::Time > > buf = 0.chr * 172 # sizeof(TIME_ZONE_INFORMATION) > GetTimeZoneInformation(buf) > > p buf[0,4].unpack(''L'')[0] # Bias > p buf[4,64].tr("\0",'''') # StandardName > p buf[68,2].unpack(''S'')[0] # Year > p buf[70,2].unpack(''S'')[0] # Month > p buf[72,2].unpack(''S'')[0] # DOW > p buf[74,2].unpack(''S'')[0] # Day > p buf[76,2].unpack(''S'')[0] # Hour > p buf[78,2].unpack(''S'')[0] # Minute > p buf[80,2].unpack(''S'')[0] # Second > p buf[82,2].unpack(''S'')[0] # Millisecond > p buf[84,4].unpack(''S'')[0] # StandardBias > p buf[88,64].tr("\0",'''') # DaylightName > p buf[152,2].unpack(''S'')[0] # Year > p buf[154,2].unpack(''S'')[0] # Month > p buf[156,2].unpack(''S'')[0] # DOW > p buf[158,2].unpack(''S'')[0] # Day > p buf[160,2].unpack(''S'')[0] # Hour > p buf[162,2].unpack(''S'')[0] # Minute > p buf[164,2].unpack(''S'')[0] # Second > p buf[166,2].unpack(''S'')[0] # Millisecond > p buf[168,4].unpack(''L'')[0] # DaylightBias > > Regards, > > Dan > > > The SYSTEMTIME structure field StandarddDate and DaylightDate is not > used with GetTimeZoneInformation API, but used with SetTimeZoneInformation. > > Refer to the sample vbnet code at > http://vbnet.mvps.org/index.html?code/locale/gettimezoneinfo.htm > > Regards, > > Park HeesobOh, silly me. Disregard. Dan