diff --git a/tests/datetime/datetimetest.cpp b/tests/datetime/datetimetest.cpp index 22b4f8dfcd..2a259ea8a9 100644 --- a/tests/datetime/datetimetest.cpp +++ b/tests/datetime/datetimetest.cpp @@ -1703,8 +1703,17 @@ TEST_CASE("wxDateTime-BST-bugs", "[datetime][dst][BST][.]") TEST_CASE("wxDateTime::UNow", "[datetime][now][unow]") { - const wxDateTime now = wxDateTime::Now(); - const wxDateTime unow = wxDateTime::UNow(); + // It's unlikely, but possible, that the consecutive functions are called + // on different sides of some second boundary, but it really shouldn't + // happen more than once in a row. + wxDateTime now, unow; + for ( int i = 0; i < 3; ++i ) + { + now = wxDateTime::Now(); + unow = wxDateTime::UNow(); + if ( now.GetSecond() == unow.GetSecond() ) + break; + } CHECK( now.GetYear() == unow.GetYear() ); CHECK( now.GetMonth() == unow.GetMonth() );