diff --git a/include/wx/cppunit.h b/include/wx/cppunit.h index a7affd50ae..3b4281cfa1 100644 --- a/include/wx/cppunit.h +++ b/include/wx/cppunit.h @@ -104,6 +104,10 @@ } \ } +// Use this macro to compare the expected time_t value with the result of not +// necessarily time_t type +#define WX_ASSERT_TIME_T_EQUAL(t, n) CPPUNIT_ASSERT_EQUAL((t), (time_t)(n)) + // Use this macro to assert with the given formatted message (it should contain // the format string and arguments in a separate pair of parentheses) #define WX_ASSERT_MESSAGE(msg, cond) \ diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index 297258a17b..7fdd2affd1 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -376,11 +376,13 @@ wxDateTime::Country wxDateTime::ms_country = wxDateTime::Country_Unknown; // debugger helper: shows what the date really is #ifdef __WXDEBUG__ -extern const wxChar *wxDumpDate(const wxDateTime* dt) +extern const char *wxDumpDate(const wxDateTime* dt) { - static wxChar buf[128]; + static char buf[128]; - wxStrcpy(buf, dt->Format(_T("%Y-%m-%d (%a) %H:%M:%S"))); + wxString fmt(dt->Format("%Y-%m-%d (%a) %H:%M:%S")); + wxStrncpy(buf, fmt + " (" + dt->GetValue().ToString() + " ticks)", + WXSIZEOF(buf)); return buf; } diff --git a/tests/datetime/datetimetest.cpp b/tests/datetime/datetimetest.cpp index 20e93fafae..9fcbd29a25 100644 --- a/tests/datetime/datetimetest.cpp +++ b/tests/datetime/datetimetest.cpp @@ -737,11 +737,11 @@ void DateTimeTestCase::TestTimeTicks() // ignore DST, the test data already takes it into account dt.MakeTimezone(TZ_TEST, true); long ticks = (dt.GetValue() / 1000).ToLong(); - CPPUNIT_ASSERT_EQUAL( d.ticks, ticks + tzOffset ); + WX_ASSERT_TIME_T_EQUAL( d.ticks, ticks + tzOffset ); dt = d.DT().FromTimezone(wxDateTime::UTC); ticks = (dt.GetValue() / 1000).ToLong(); - CPPUNIT_ASSERT_EQUAL( d.gmticks, ticks ); + WX_ASSERT_TIME_T_EQUAL( d.gmticks, ticks ); } }