X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..60b73526d6797ee466c272dbfca962a230bc5908:/include/wx/datetime.h diff --git a/include/wx/datetime.h b/include/wx/datetime.h index 688b2debf4..1dc31ef6d5 100644 --- a/include/wx/datetime.h +++ b/include/wx/datetime.h @@ -17,6 +17,8 @@ #pragma interface "datetime.h" #endif +#if wxUSE_DATETIME + #include #include // for INT_MIN @@ -36,6 +38,19 @@ class WXDLLEXPORT wxDateSpan; #define inline #endif // Debug +// not all c-runtimes are based on 1/1/1970 being (time_t) 0 +// set this to the corresponding value in seconds 1/1/1970 has on your +// systems c-runtime + +#ifdef __WXMAC__ +#if __MSL__ < 0x6000 + #define WX_TIME_BASE_OFFSET ( 2082844800L + 126144000L ) +#else + #define WX_TIME_BASE_OFFSET 0 +#endif +#else + #define WX_TIME_BASE_OFFSET 0 +#endif /* * TODO * @@ -100,7 +115,7 @@ class WXDLLEXPORT wxDateSpan; // wxInvalidDateTime) class WXDLLEXPORT wxDateTime; -WXDLLEXPORT_DATA(extern wxDateTime&) wxDefaultDateTime; +WXDLLEXPORT_DATA(extern const wxDateTime&) wxDefaultDateTime; #define wxInvalidDateTime wxDefaultDateTime // ---------------------------------------------------------------------------- @@ -526,7 +541,7 @@ public: // ------------------------------------------------------------------------ // default ctor does not initialize the object, use Set()! - wxDateTime() { } + wxDateTime() { m_time = wxLongLong((long)ULONG_MAX, ULONG_MAX); } // from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970) #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) @@ -548,7 +563,7 @@ public: wxDateTime_t millisec = 0); // from separate values for each component with explicit date inline wxDateTime(wxDateTime_t day, // day of the month - Month month = Inv_Month, + Month month, int year = Inv_Year, // 1999, not 99 please! wxDateTime_t hour = 0, wxDateTime_t minute = 0, @@ -591,7 +606,7 @@ public: // from separate values for each component with explicit date // (defaults for month and year are the current values) wxDateTime& Set(wxDateTime_t day, - Month month = Inv_Month, + Month month, int year = Inv_Year, // 1999, not 99 please! wxDateTime_t hour = 0, wxDateTime_t minute = 0, @@ -760,8 +775,8 @@ public: // result of timezone shift) // ------------------------------------------------------------------------ - // is the date valid (TRUE even for non initialized objects)? - inline bool IsValid() const { return this != &wxInvalidDateTime; } + // is the date valid? + inline bool IsValid() const { return m_time != wxInvalidDateTime.m_time; } // get the broken down date/time representation in the given timezone // @@ -1557,4 +1572,6 @@ inline WXDLLEXPORT void wxPrevWDay(wxDateTime::WeekDay& wd) : (wxDateTime::WeekDay)(wd - 1); } +#endif // wxUSE_DATETIME + #endif // _WX_DATETIME_H