Consistently handle DST start time in wxDateTime::Set().
Always move the dates invalid due to DST (i.e. falling into the "missing" hour on the DST start date) forward, as GNU libc does, even when using a different CRT implementation, such as MSVC one which moves the invalid dates backwards. This seems more expected and also fixes an especially bad problem which happened due to moving the date backwards in Brazilian time zone where DST starts at midnight as doing this changed the day and totally broke ParseDate() assumption that setting wxDateTime to 00:00:00 at the given date really did set it to this date. Closes #15419. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74777 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1335,6 +1335,19 @@ void DateTimeTestCase::TestDSTBug()
|
||||
CPPUNIT_ASSERT_EQUAL(0, (int)dt2.GetSecond());
|
||||
CPPUNIT_ASSERT_EQUAL(0, (int)dt2.GetMillisecond());
|
||||
#endif // CHANGE_SYSTEM_DATE
|
||||
|
||||
// Verify that setting the date to the beginning of the DST period moves it
|
||||
// forward (as this date on its own would be invalid). The problem here is
|
||||
// that our GetBeginDST() is far from being trustworthy, so just try a
|
||||
// couple of dates for the common time zones and check that all of them are
|
||||
// either unchanged or moved forward.
|
||||
wxDateTime dtDST(10, wxDateTime::Mar, 2013, 2, 0, 0);
|
||||
if ( dtDST.GetHour() != 2 )
|
||||
CPPUNIT_ASSERT_EQUAL( 3, dtDST.GetHour() );
|
||||
|
||||
dtDST = wxDateTime(31, wxDateTime::Mar, 2013, 2, 0, 0);
|
||||
if ( dtDST.GetHour() != 2 )
|
||||
CPPUNIT_ASSERT_EQUAL( 3, dtDST.GetHour() );
|
||||
}
|
||||
|
||||
void DateTimeTestCase::TestDateOnly()
|
||||
|
Reference in New Issue
Block a user