Thanks for that. I think the following mods are needed:
months[tz.StandardDate.wMonth], changed to months[tz.StandardDate.wMonth-1], and months[tz.DaylightDate.wMonth], changed to months[tz.DaylightDate.wMonth-1], When I make these changes, the results are what I expect. I verified the info correlates with the following prog: http://17slon.com/gp/gp/gptimezone.htm FYI: my tsinfo output. (correct) ================================= Currently in Standard time Your current offset from GMT is -600 minutes Standard Time in your time zone is called AUS Eastern Standard Time Standard Time starts on the last Sunday in March Standard Time bias is 0 minutes Daylight Time in your time zone is called AUS Eastern Daylight Time Daylight Time starts on the last Sunday in October Daylight Time bias is -60 minutes ================================= Without my mods, I get: ================================= Currently in Standard time Your current offset from GMT is -600 minutes Standard Time in your time zone is called AUS Eastern Standard Time Standard Time starts on the last Sunday in April Standard Time bias is 0 minutes Daylight Time in your time zone is called AUS Eastern Daylight Time Daylight Time starts on the last Sunday in November Daylight Time bias is -60 minutes ================================= Clearly wrong. Thanks, Rob :-) > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Tracy > Sent: Friday, July 25, 2003 1:24 AM > To: [EMAIL PROTECTED] > Subject: [xmail] Re: FW: Re: Log Rotation > > > At 04:38 7/24/2003, Rob Arends wrote: > >But how do you determine WHEN to apply the daylight offset and > WHAT is the > >offset? > > // TSInfo.cpp : Defines the entry point for the console application. > // > > #include <stdio.h> > #include <windows.h> > > // there's probably a better way to handle this part > // but I was in a hurry and didn't look for it...:) > LPTSTR ordinals[] = {"", > "first", > "second", > "third", > "fourth", > "fifth"}; > > LPTSTR weekdays[] = {"Sunday", > "Monday", > "Tuesday", > "Wednesday", > "Thursday", > "Friday", > "Saturday"}; > > LPTSTR months[] = { "January", > "February", > "March", > "April", > "May", > "June", > "July", > "August", > "September", > "October", > "November", > "December"}; > > int main(int argc, char* argv[]) > { > TIME_ZONE_INFORMATION tz; > DWORD status; > > status = GetTimeZoneInformation(&tz); > switch (status) > { > case TIME_ZONE_ID_INVALID: > { > DWORD count; > LPTSTR buffer; > > count = > FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | > > FORMAT_MESSAGE_ALLOCATE_BUFFER | > FORMAT_MESSAGE_IGNORE_INSERTS, > 0, > GetLastError(), > 0, > buffer, > 0, > 0); > printf("%s\r\n", buffer); > LocalFree((HLOCAL)buffer); > break; > } > case TIME_ZONE_ID_UNKNOWN: > { > printf("Unknown time zone information\r\n"); > break; > } > default: > { > if (status == TIME_ZONE_ID_STANDARD) > printf("Currently in Standard time\r\n"); > else if (status == TIME_ZONE_ID_DAYLIGHT) > printf("Currently in Daylight time\r\n"); > else > printf("Unable to determine Standard or > Daylight"); > > printf("Your current offset from GMT is %i > minutes\r\n", > tz.Bias); > > printf("Standard Time in your time zone > is called > %S\r\n", > (LPWSTR)tz.StandardName); > > if (tz.StandardDate.wYear == 0) > printf("Standard Time starts on > the %s %s > in %s\r\n", > ordinals[tz.StandardDate.wDay], > > weekdays[tz.StandardDate.wDayOfWeek], > months[tz.StandardDate.wMonth]); > else > printf("Standard Time starts on > %s, %n %s > %n\r\n", > > weekdays[tz.StandardDate.wDayOfWeek], > tz.StandardDate.wDay, > months[tz.StandardDate.wMonth], > tz.StandardDate.wYear); > > printf("Standard Time bias is %i minutes\r\n", > tz.StandardBias); > > printf("Daylight Time in your time zone > is called > %S\r\n", > (LPWSTR)tz.DaylightName); > > if (tz.DaylightDate.wYear == 0) > printf("Daylight Time starts on > the %s %s > in %s\r\n", > ordinals[tz.DaylightDate.wDay], > > weekdays[tz.DaylightDate.wDayOfWeek], > months[tz.DaylightDate.wMonth]); > else > printf("Standard Time starts on > %s, %n %s > %n\r\n", > > weekdays[tz.DaylightDate.wDayOfWeek], > tz.DaylightDate.wDay, > months[tz.DaylightDate.wMonth], > tz.DaylightDate.wYear); > > printf("Daylight Time bias is %i minutes\r\n", > tz.DaylightBias); > } > > } > return 0; > } > > > - > To unsubscribe from this list: send the line "unsubscribe xmail" in > the body of a message to [EMAIL PROTECTED] > For general help: send the line "help" in the body of a message to > [EMAIL PROTECTED] > > - To unsubscribe from this list: send the line "unsubscribe xmail" in the body of a message to [EMAIL PROTECTED] For general help: send the line "help" in the body of a message to [EMAIL PROTECTED]