git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53893
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
void DateTimeTestCase::TestTimeTicks()
{
void DateTimeTestCase::TestTimeTicks()
{
+ static const wxDateTime::TZ TZ_TEST = wxDateTime::NZST;
+
+ // this test depends on the local time zone so to make it work everywhere
+ // we need to adjust the expected results
+ const long tzOffset = wxDateTime::TimeZone(wxDateTime::Local).GetOffset() -
+ wxDateTime::TimeZone(TZ_TEST).GetOffset();
+
for ( size_t n = 0; n < WXSIZEOF(testDates); n++ )
{
const Date& d = testDates[n];
for ( size_t n = 0; n < WXSIZEOF(testDates); n++ )
{
const Date& d = testDates[n];
continue;
wxDateTime dt = d.DT();
continue;
wxDateTime dt = d.DT();
- //RN: Translate according to test's time zone
- //2nd param is to ignore DST - it's already factored
- //into Vadim's tests
- dt.MakeTimezone(wxDateTime::WEST, true);
+
+ // ignore DST, the test data already takes it into account
+ dt.MakeTimezone(TZ_TEST, true);
long ticks = (dt.GetValue() / 1000).ToLong();
long ticks = (dt.GetValue() / 1000).ToLong();
- CPPUNIT_ASSERT_EQUAL( d.ticks, ticks );
+ CPPUNIT_ASSERT_EQUAL( d.ticks, ticks + tzOffset );
- dt = d.DT().FromTimezone(wxDateTime::GMT0);
+ dt = d.DT().FromTimezone(wxDateTime::UTC);
ticks = (dt.GetValue() / 1000).ToLong();
CPPUNIT_ASSERT_EQUAL( d.gmticks, ticks );
}
ticks = (dt.GetValue() / 1000).ToLong();
CPPUNIT_ASSERT_EQUAL( d.gmticks, ticks );
}