]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/datetime.cpp
new wxStringTokenizer
[wxWidgets.git] / src / common / datetime.cpp
index e9b1e7c677f93ea9c4b10c00e79f86a49b8b58ee..04fac9daaf512a348d180a1345e8a7d02e599566 100644 (file)
@@ -75,6 +75,8 @@
 
 #define wxDEFINE_TIME_CONSTANTS // before including datetime.h
 
+#include <ctype.h>
+
 #include "wx/datetime.h"
 
 // ----------------------------------------------------------------------------
@@ -95,6 +97,9 @@
 #ifndef WX_TIMEZONE
     #if defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__)
         #define WX_TIMEZONE _timezone
+    #elif defined(__MWERKS__)
+       long wxmw_timezone = 28800;
+       #define WX_TIMEZONE wxmw_timezone ;
     #else // unknown platform - try timezone
         #define WX_TIMEZONE timezone
     #endif
@@ -117,6 +122,7 @@ public:
     virtual void OnExit()
     {
         wxDateTimeHolidayAuthority::ClearAllAuthorities();
+        wxDateTimeHolidayAuthority::ms_authorities.Clear();
     }
 
 private:
@@ -190,7 +196,7 @@ wxDateTime::Country wxDateTime::ms_country = wxDateTime::Country_Unknown;
 #ifdef __WXDEBUG__
 extern const wxChar *wxDumpDate(const wxDateTime* dt)
 {
-    static wxChar buf[20];
+    static wxChar buf[128];
 
     wxStrcpy(buf, dt->Format(_T("%Y-%m-%d (%a) %H:%M:%S")));
 
@@ -1636,20 +1642,15 @@ wxDateTime::wxDateTime_t wxDateTime::GetWeekOfMonth(wxDateTime::WeekFlags flags,
 {
     Tm tm = GetTm(tz);
     wxDateTime dtMonthStart = wxDateTime(1, tm.mon, tm.year);
-    size_t nWeek = GetWeekOfYear(flags) - dtMonthStart.GetWeekOfYear(flags) + 1;
-#ifdef __VMS__ // nWeek is unsigned so avoid the warning
-   int nweek2 = (int) nWeek;
-   if ( nweek2 < 0 )
-#else
+    int nWeek = GetWeekOfYear(flags) - dtMonthStart.GetWeekOfYear(flags) + 1;
     if ( nWeek < 0 )
-#endif
     {
         // this may happen for January when Jan, 1 is the last week of the
         // previous year
         nWeek += IsLeapYear(tm.year - 1) ? 53 : 52;
     }
 
-    return nWeek;
+    return (wxDateTime::wxDateTime_t)nWeek;
 }
 
 wxDateTime& wxDateTime::SetToYearDay(wxDateTime::wxDateTime_t yday)
@@ -3481,9 +3482,9 @@ wxDateTimeHolidayAuthority::GetHolidaysInRange(const wxDateTime& dtStart,
     holidays.Empty();
 
     size_t count = ms_authorities.GetCount();
-    for ( size_t n = 0; n < count; n++ )
+    for ( size_t nAuth = 0; nAuth < count; nAuth++ )
     {
-        ms_authorities[n]->DoGetHolidaysInRange(dtStart, dtEnd, hol);
+        ms_authorities[nAuth]->DoGetHolidaysInRange(dtStart, dtEnd, hol);
 
         WX_APPEND_ARRAY(holidays, hol);
     }