really fixed bug with DST in Set(h, m, s, ms) (see patch 1097811)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32350 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1291,18 +1291,21 @@ wxDateTime& wxDateTime::Set(wxDateTime_t hour,
|
|||||||
|
|
||||||
wxDATETIME_CHECK( tm, _T("localtime() failed") );
|
wxDATETIME_CHECK( tm, _T("localtime() failed") );
|
||||||
|
|
||||||
|
// make a copy so it isn't clobbered by the call to mktime() below
|
||||||
|
struct tm tm1(*tm);
|
||||||
|
|
||||||
// adjust the time
|
// adjust the time
|
||||||
tm->tm_hour = hour;
|
tm1.tm_hour = hour;
|
||||||
tm->tm_min = minute;
|
tm1.tm_min = minute;
|
||||||
tm->tm_sec = second;
|
tm1.tm_sec = second;
|
||||||
|
|
||||||
// and the DST in case it changes on this date
|
// and the DST in case it changes on this date
|
||||||
struct tm tm2(*tm);
|
struct tm tm2(tm1);
|
||||||
mktime(&tm2);
|
mktime(&tm2);
|
||||||
if ( tm2.tm_isdst != tm->tm_isdst )
|
if ( tm2.tm_isdst != tm1.tm_isdst )
|
||||||
tm->tm_isdst = tm2.tm_isdst;
|
tm1.tm_isdst = tm2.tm_isdst;
|
||||||
|
|
||||||
(void)Set(*tm);
|
(void)Set(tm1);
|
||||||
|
|
||||||
// and finally adjust milliseconds
|
// and finally adjust milliseconds
|
||||||
return SetMillisecond(millisec);
|
return SetMillisecond(millisec);
|
||||||
|
Reference in New Issue
Block a user