X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9c21e80bb05128b6b3b886ae5163d52da4bff2a9..56c6aab7e6fe6dccd753fd94d07a44ded2ba70d1:/include/wx/datetime.h diff --git a/include/wx/datetime.h b/include/wx/datetime.h index b0edbf9efe..7c75150dba 100644 --- a/include/wx/datetime.h +++ b/include/wx/datetime.h @@ -56,7 +56,7 @@ class WXDLLIMPEXP_BASE wxDateSpan; #ifdef HAVE_LOCALTIME_R #define wxLocaltime_r localtime_r #else -struct tm *wxLocaltime_r(const time_t*, struct tm*); +WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*); #if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) // On Windows, localtime _is_ threadsafe! #warning using pseudo thread-safe wrapper for localtime to emulate localtime_r @@ -66,7 +66,7 @@ struct tm *wxLocaltime_r(const time_t*, struct tm*); #ifdef HAVE_GMTIME_R #define wxGmtime_r gmtime_r #else -struct tm *wxGmtime_r(const time_t*, struct tm*); +WXDLLIMPEXP_BASE struct tm *wxGmtime_r(const time_t*, struct tm*); #if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) // On Windows, gmtime _is_ threadsafe! #warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r @@ -168,7 +168,7 @@ public: GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1, GMT0, GMT1, GMT2, GMT3, GMT4, GMT5, GMT6, - GMT7, GMT8, GMT9, GMT10, GMT11, GMT12, + GMT7, GMT8, GMT9, GMT10, GMT11, GMT12, GMT13, // Note that GMT12 and GMT_12 are not the same: there is a difference // of exactly one day between them @@ -202,10 +202,14 @@ public: // Australia A_WST = GMT8, // Western Standard Time - A_CST = GMT12 + 1, // Central Standard Time (+9.5) + A_CST = GMT13 + 1, // Central Standard Time (+9.5) A_EST = GMT10, // Eastern Standard Time A_ESST = GMT11, // Eastern Summer Time + // New Zealand + NZST = GMT12, // Standard Time + NZDT = GMT13, // Daylight Saving Time + // TODO add more symbolic timezone names here // Universal Coordinated Time = the new and politically correct name @@ -503,7 +507,7 @@ public: static bool IsLeapYear(int year = Inv_Year, Calendar cal = Gregorian); // get the century (19 for 1999, 20 for 2000 and -5 for 492 BC) - static int GetCentury(int year = Inv_Year); + static int GetCentury(int year); // returns the number of days in this year (356 or 355 for Gregorian // calendar usually :-) @@ -838,6 +842,9 @@ public: // if the value is out of range inline time_t GetTicks() const; + // get the century, same as GetCentury(GetYear()) + int GetCentury(const TimeZone& tz = Local) const + { return GetCentury(GetYear(tz)); } // get the year (returns Inv_Year if date is invalid) int GetYear(const TimeZone& tz = Local) const { return GetTm(tz).year; } @@ -1114,6 +1121,10 @@ public: // constructors // ------------------------------------------------------------------------ + // return the timespan for the given number of milliseconds + static wxTimeSpan Milliseconds(wxLongLong ms) { return wxTimeSpan(0, 0, 0, ms); } + static wxTimeSpan Millisecond() { return Milliseconds(1); } + // return the timespan for the given number of seconds static wxTimeSpan Seconds(wxLongLong sec) { return wxTimeSpan(0, 0, sec); } static wxTimeSpan Second() { return Seconds(1); }