- wxString str ;
- SYSTEMTIME SystemTime;
- TIME_ZONE_INFORMATION pTz;
- static struct tm st_res ; // data holder
- static struct tm * res = &st_res ; // data pointer
- int iLeap;
- const unsigned short int __mon_yday[2][13] =
- {
- // Normal years
- { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
- // Leap years
- { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
- };
-
- ::GetLocalTime(&SystemTime) ;
- ::GetTimeZoneInformation(&pTz);
-
- ///////////////////////////////////////////////
- // Set timezone
- timezone = pTz.Bias * SECONDS_IN_ONE_MINUTE ;
- ///////////////////////////////////////////////
-
- iLeap = is_leap(SystemTime.wYear) ;
-
- res->tm_hour = SystemTime.wHour;
- res->tm_min = SystemTime.wMinute;
- res->tm_sec = SystemTime.wSecond;
-
- res->tm_mday = SystemTime.wDay;
- res->tm_mon = SystemTime.wMonth - 1;// this the correct month but localtime returns month aligned to zero
- res->tm_year = SystemTime.wYear; // this the correct year
- res->tm_year = res->tm_year - 1900; // but localtime returns the value starting at the 1900
-
- res->tm_wday = SystemTime.wDayOfWeek;
- res->tm_yday = __mon_yday[iLeap][res->tm_mon] + SystemTime.wDay - 1; // localtime returns year-day aligned to zero
-
- // if localtime behavior and daylight saving
- if (bLocal && pTz.DaylightBias != 0)
- res->tm_isdst = 1;
- else
- res->tm_isdst = 0; // without daylight saving or gmtime
+ wxString str ;
+ SYSTEMTIME SystemTime;
+ TIME_ZONE_INFORMATION pTz;
+ static struct tm st_res ; // data holder
+ static struct tm * res = &st_res ; // data pointer
+ int iLeap;
+ const unsigned short int __mon_yday[2][13] =
+ {
+ // Normal years
+ { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
+ // Leap years
+ { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
+ };
+
+ ::GetLocalTime(&SystemTime) ;
+ ::GetTimeZoneInformation(&pTz);
+
+ ///////////////////////////////////////////////
+ // Set timezone
+ timezone = pTz.Bias * SECONDS_IN_ONE_MINUTE ;
+ ///////////////////////////////////////////////
+
+ iLeap = is_leap(SystemTime.wYear) ;
+
+ res->tm_hour = SystemTime.wHour;
+ res->tm_min = SystemTime.wMinute;
+ res->tm_sec = SystemTime.wSecond;
+
+ res->tm_mday = SystemTime.wDay;
+ res->tm_mon = SystemTime.wMonth - 1; // this the correct month but localtime returns month aligned to zero
+ res->tm_year = SystemTime.wYear; // this the correct year
+ res->tm_year = res->tm_year - 1900; // but localtime returns the value starting at the 1900
+
+ res->tm_wday = SystemTime.wDayOfWeek;
+ res->tm_yday = __mon_yday[iLeap][res->tm_mon] + SystemTime.wDay - 1; // localtime returns year-day aligned to zero
+
+ // if localtime behavior and daylight saving
+ if (bLocal && pTz.DaylightBias != 0)
+ res->tm_isdst = 1;
+ else
+ res->tm_isdst = 0; // without daylight saving or gmtime