and now timezones work even better ;-)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -359,13 +359,6 @@ static void TestTimeSet()
|
|||||||
{
|
{
|
||||||
puts("\n*** wxDateTime construction test ***");
|
puts("\n*** wxDateTime construction test ***");
|
||||||
|
|
||||||
#if 0
|
|
||||||
printf("Current time:\t%s\n", wxDateTime::Now().Format().c_str());
|
|
||||||
printf("Unix epoch:\t%s\n", wxDateTime((time_t)0).Format().c_str());
|
|
||||||
printf("Today noon:\t%s\n", wxDateTime(12, 0).Format().c_str());
|
|
||||||
printf("May 29, 1976:\t%s\n", wxDateTime(29, wxDateTime::May, 1976).Format().c_str());
|
|
||||||
printf("Jan 1, 1900:\t%s\n", wxDateTime(1, wxDateTime::Jan, 1900).Format().c_str());
|
|
||||||
#else
|
|
||||||
for ( size_t n = 0; n < WXSIZEOF(testDates); n++ )
|
for ( size_t n = 0; n < WXSIZEOF(testDates); n++ )
|
||||||
{
|
{
|
||||||
const Date& d1 = testDates[n];
|
const Date& d1 = testDates[n];
|
||||||
@@ -381,7 +374,6 @@ static void TestTimeSet()
|
|||||||
s1.c_str(), s2.c_str(),
|
s1.c_str(), s2.c_str(),
|
||||||
s1 == s2 ? "ok" : "ERROR");
|
s1 == s2 ? "ok" : "ERROR");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// test time zones stuff
|
// test time zones stuff
|
||||||
@@ -926,8 +918,8 @@ int main(int argc, char **argv)
|
|||||||
TestTimeZones();
|
TestTimeZones();
|
||||||
TestTimeRange();
|
TestTimeRange();
|
||||||
TestTimeTicks();
|
TestTimeTicks();
|
||||||
TestTimeJDN();
|
|
||||||
}
|
}
|
||||||
|
TestTimeJDN();
|
||||||
#endif // TEST_TIME
|
#endif // TEST_TIME
|
||||||
|
|
||||||
wxUninitialize();
|
wxUninitialize();
|
||||||
|
@@ -688,6 +688,7 @@ wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
time += tz.GetOffset();
|
||||||
tm = gmtime(&time);
|
tm = gmtime(&time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -701,7 +702,7 @@ wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const
|
|||||||
// remember the time and do the calculations with the date only - this
|
// remember the time and do the calculations with the date only - this
|
||||||
// eliminates rounding errors of the floating point arithmetics
|
// eliminates rounding errors of the floating point arithmetics
|
||||||
|
|
||||||
wxLongLong timeMidnight = m_time - GetTimeZone() * 1000;
|
wxLongLong timeMidnight = m_time + tz.GetOffset() * 1000;
|
||||||
|
|
||||||
long timeOnly = (timeMidnight % MILLISECONDS_PER_DAY).ToLong();
|
long timeOnly = (timeMidnight % MILLISECONDS_PER_DAY).ToLong();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user