X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fb7ce3e8cc980192d8ef0f7775a55206eb4c514a..fe8aae41abf98f090ff59cdaec70ced89f8318fd:/src/common/time.cpp diff --git a/src/common/time.cpp b/src/common/time.cpp index 03df19ec62..ff163db0cc 100644 --- a/src/common/time.cpp +++ b/src/common/time.cpp @@ -36,7 +36,7 @@ #ifndef WX_GMTOFF_IN_TM // Define it for some systems which don't (always) use configure but are // known to have tm_gmtoff field. - #if defined(__WXPALMOS__) || defined(__DARWIN__) + #if defined(__DARWIN__) #define WX_GMTOFF_IN_TM #endif #endif @@ -53,14 +53,12 @@ # undef HAVE_GETTIMEOFDAY #endif -#ifndef __WXPALMOS5__ #ifndef __WXWINCE__ #include #else #include "wx/msw/private.h" #include "wx/msw/wince/time.h" #endif -#endif // __WXPALMOS5__ #if !defined(__WXMAC__) && !defined(__WXWINCE__) @@ -74,12 +72,6 @@ #include #endif -#ifdef __WXPALMOS__ - #include - #include - #include -#endif - #if defined(__MWERKS__) && wxUSE_UNICODE #include #endif @@ -223,15 +215,22 @@ int wxGetTimeZone() #else // VC++ < 8 return timezone; #endif -#elif defined(WX_TIMEZONE) // If WX_TIMEZONE was defined by configure, use it. - return WX_TIMEZONE; -#elif defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__) - return _timezone; -#elif defined(__MWERKS__) - return 28800; -#else // unknown platform -- assume it has timezone - return timezone; -#endif // WX_GMTOFF_IN_TM/!WX_GMTOFF_IN_TM +#else // Use some kind of time zone variable. + // In any case we must initialize the time zone before using it. + tzset(); + + #if defined(WX_TIMEZONE) // If WX_TIMEZONE was defined by configure, use it. + return WX_TIMEZONE; + #elif defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__) + return _timezone; + #elif defined(__MWERKS__) + // This is just plain wrong but apparently MetroWerks runtime didn't have + // any way to get the time zone. + return 28800; + #else // unknown platform -- assume it has timezone + return timezone; + #endif // different time zone variables +#endif // different ways to determine time zone } // Get local time as seconds since 00:00:00, Jan 1st 1970 @@ -310,19 +309,7 @@ wxLongLong wxGetUTCTimeMillis() // If possible, use a function which avoids conversions from // broken-up time structures to milliseconds -#if defined(__WXPALMOS__) - DateTimeType thenst; - thenst.second = 0; - thenst.minute = 0; - thenst.hour = 0; - thenst.day = 1; - thenst.month = 1; - thenst.year = 1970; - thenst.weekDay = 5; - uint32_t now = TimGetSeconds(); - uint32_t then = TimDateTimeToSeconds (&thenst); - return SysTimeToMilliSecs(SysTimeInSecs(now - then)); -#elif defined(__WXMSW__) +#if defined(__WXMSW__) FILETIME ft; ::GetSystemTimeAsFileTime(&ft);