git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19364
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
return daysInMonth[wxDateTime::IsLeapYear(year)][month];
}
return daysInMonth[wxDateTime::IsLeapYear(year)][month];
}
-// ensure that the timezone variable is set by calling localtime
+// returns the time zone in the C sense, i.e. the difference UTC - local
+// (in seconds)
static int GetTimeZone()
{
// set to TRUE when the timezone is set
static int GetTimeZone()
{
// set to TRUE when the timezone is set
#ifdef WX_GMTOFF_IN_TM
static long gmtoffset = LONG_MAX; // invalid timezone
#endif
#ifdef WX_GMTOFF_IN_TM
static long gmtoffset = LONG_MAX; // invalid timezone
#endif
wxCRIT_SECT_LOCKER(lock, gs_critsectTimezone);
wxCRIT_SECT_LOCKER(lock, gs_critsectTimezone);
+ // ensure that the timezone variable is set by calling localtime
if ( !s_timezoneSet )
{
// just call localtime() instead of figuring out whether this system
// supports tzset(), _tzset() or something else
if ( !s_timezoneSet )
{
// just call localtime() instead of figuring out whether this system
// supports tzset(), _tzset() or something else
struct tm *tm;
tm = localtime(&t);
s_timezoneSet = TRUE;
struct tm *tm;
tm = localtime(&t);
s_timezoneSet = TRUE;
- gmtoffset = tm->tm_gmtoff;
+ // note that GMT offset is the opposite of time zone and so to return
+ // consistent results in both WX_GMTOFF_IN_TM and !WX_GMTOFF_IN_TM
+ // cases we have to negate it
+ gmtoffset = -tm->tm_gmtoff;