Fix bug in GetTimeZone where timezone wasn't set.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38702 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -64,6 +64,8 @@ All:
|
|||||||
and WXK*PAGEDOWN. If you have switch statements that use both
|
and WXK*PAGEDOWN. If you have switch statements that use both
|
||||||
constants from a set then you need to remove the PRIOR/NEXT
|
constants from a set then you need to remove the PRIOR/NEXT
|
||||||
versions in order to eliminate compiler errors.
|
versions in order to eliminate compiler errors.
|
||||||
|
- Fixed bug where wxDateTime::Now() would sometimes return an incorrect value
|
||||||
|
the first time it was called.
|
||||||
|
|
||||||
|
|
||||||
All (GUI):
|
All (GUI):
|
||||||
|
@@ -327,7 +327,6 @@ wxDateTime::wxDateTime_t GetNumOfDaysInMonth(int year, wxDateTime::Month month)
|
|||||||
// (in seconds)
|
// (in seconds)
|
||||||
static int GetTimeZone()
|
static int GetTimeZone()
|
||||||
{
|
{
|
||||||
#ifdef WX_GMTOFF_IN_TM
|
|
||||||
// set to true when the timezone is set
|
// set to true when the timezone is set
|
||||||
static bool s_timezoneSet = false;
|
static bool s_timezoneSet = false;
|
||||||
static long gmtoffset = LONG_MAX; // invalid timezone
|
static long gmtoffset = LONG_MAX; // invalid timezone
|
||||||
@@ -344,16 +343,17 @@ static int GetTimeZone()
|
|||||||
tm = wxLocaltime_r(&t, &tmstruct);
|
tm = wxLocaltime_r(&t, &tmstruct);
|
||||||
s_timezoneSet = true;
|
s_timezoneSet = true;
|
||||||
|
|
||||||
|
#ifdef WX_GMTOFF_IN_TM
|
||||||
// note that GMT offset is the opposite of time zone and so to return
|
// 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
|
// consistent results in both WX_GMTOFF_IN_TM and !WX_GMTOFF_IN_TM
|
||||||
// cases we have to negate it
|
// cases we have to negate it
|
||||||
gmtoffset = -tm->tm_gmtoff;
|
gmtoffset = -tm->tm_gmtoff;
|
||||||
|
#else // !WX_GMTOFF_IN_TM
|
||||||
|
gmtoffset = WX_TIMEZONE;
|
||||||
|
#endif // WX_GMTOFF_IN_TM/!WX_GMTOFF_IN_TM
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)gmtoffset;
|
return (int)gmtoffset;
|
||||||
#else // !WX_GMTOFF_IN_TM
|
|
||||||
return (int)WX_TIMEZONE;
|
|
||||||
#endif // WX_GMTOFF_IN_TM/!WX_GMTOFF_IN_TM
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the integral part of the JDN for the midnight of the given date (to
|
// return the integral part of the JDN for the midnight of the given date (to
|
||||||
|
Reference in New Issue
Block a user