-// this test miscellaneous static wxDateTime functions
-
-#if TEST_ALL
-
-static void TestTimeStatic()
-{
- wxPuts(wxT("\n*** wxDateTime static methods test ***"));
-
- // some info about the current date
- int year = wxDateTime::GetCurrentYear();
- wxPrintf(wxT("Current year %d is %sa leap one and has %d days.\n"),
- year,
- wxDateTime::IsLeapYear(year) ? "" : "not ",
- wxDateTime::GetNumberOfDays(year));
-
- wxDateTime::Month month = wxDateTime::GetCurrentMonth();
- wxPrintf(wxT("Current month is '%s' ('%s') and it has %d days\n"),
- wxDateTime::GetMonthName(month, wxDateTime::Name_Abbr).c_str(),
- wxDateTime::GetMonthName(month).c_str(),
- wxDateTime::GetNumberOfDays(month));
-}
-
-// test time zones stuff
-static void TestTimeZones()
-{
- wxPuts(wxT("\n*** wxDateTime timezone test ***"));
-
- wxDateTime now = wxDateTime::Now();
-
- wxPrintf(wxT("Current GMT time:\t%s\n"), now.Format(wxT("%c"), wxDateTime::GMT0).c_str());
- wxPrintf(wxT("Unix epoch (GMT):\t%s\n"), wxDateTime((time_t)0).Format(wxT("%c"), wxDateTime::GMT0).c_str());
- wxPrintf(wxT("Unix epoch (EST):\t%s\n"), wxDateTime((time_t)0).Format(wxT("%c"), wxDateTime::EST).c_str());
- wxPrintf(wxT("Current time in Paris:\t%s\n"), now.Format(wxT("%c"), wxDateTime::CET).c_str());
- wxPrintf(wxT(" Moscow:\t%s\n"), now.Format(wxT("%c"), wxDateTime::MSK).c_str());
- wxPrintf(wxT(" New York:\t%s\n"), now.Format(wxT("%c"), wxDateTime::EST).c_str());
-
- wxPrintf(wxT("%s\n"), wxDateTime::Now().Format(wxT("Our timezone is %Z")).c_str());
-
- wxDateTime::Tm tm = now.GetTm();
- if ( wxDateTime(tm) != now )
- {
- wxPrintf(wxT("ERROR: got %s instead of %s\n"),
- wxDateTime(tm).Format().c_str(), now.Format().c_str());
- }
-}
-
-// test some minimal support for the dates outside the standard range
-static void TestTimeRange()
-{
- wxPuts(wxT("\n*** wxDateTime out-of-standard-range dates test ***"));
-
- static const wxChar *fmt = wxT("%d-%b-%Y %H:%M:%S");
-
- wxPrintf(wxT("Unix epoch:\t%s\n"),
- wxDateTime(2440587.5).Format(fmt).c_str());
- wxPrintf(wxT("Feb 29, 0: \t%s\n"),
- wxDateTime(29, wxDateTime::Feb, 0).Format(fmt).c_str());
- wxPrintf(wxT("JDN 0: \t%s\n"),
- wxDateTime(0.0).Format(fmt).c_str());
- wxPrintf(wxT("Jan 1, 1AD:\t%s\n"),
- wxDateTime(1, wxDateTime::Jan, 1).Format(fmt).c_str());
- wxPrintf(wxT("May 29, 2099:\t%s\n"),
- wxDateTime(29, wxDateTime::May, 2099).Format(fmt).c_str());
-}
-
-// test DST calculations
-static void TestTimeDST()
-{
- wxPuts(wxT("\n*** wxDateTime DST test ***"));
-
- wxPrintf(wxT("DST is%s in effect now.\n\n"),
- wxDateTime::Now().IsDST() ? wxEmptyString : wxT(" not"));
-
- for ( int year = 1990; year < 2005; year++ )
- {
- wxPrintf(wxT("DST period in Europe for year %d: from %s to %s\n"),
- year,
- wxDateTime::GetBeginDST(year, wxDateTime::Country_EEC).Format().c_str(),
- wxDateTime::GetEndDST(year, wxDateTime::Country_EEC).Format().c_str());
- }
-}
-
-#endif // TEST_ALL
-