From: Vadim Zeitlin Date: Tue, 2 Nov 2010 11:57:30 +0000 (+0000) Subject: Use _get_timezone() function instead of _timezone with MSVC8+. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7e9c57542f80717be57dfb1ea51b050c902ebfa2 Use _get_timezone() function instead of _timezone with MSVC8+. While some (but not all) versions of VC8 CRT still define _timezone variable, it is deprecated and shouldn't be used and referencing it can result in linking problems if it pulls in static CRT. Just use _get_timezone() function instead for the VC versions that support it (as was already done in r54417 for VC8 in 2.8 branch). Closes #4691. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65994 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index 4e0ea0fa69..4bbca2e476 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -137,30 +137,22 @@ wxCUSTOM_TYPE_INFO(wxDateTime, wxToStringConverter , wxFromStringCon #define WX_TIMEZONE wxGetTimeZone() #elif defined(__DARWIN__) #define WX_GMTOFF_IN_TM - #elif defined(__WXWINCE__) && defined(__VISUALC8__) - // _timezone is not present in dynamic run-time library - #if 0 - // Solution (1): use the function equivalent of _timezone + #elif wxCHECK_VISUALC_VERSION(8) + // While _timezone is still present in (some versions of) VC CRT, it's + // deprecated and _get_timezone() should be used instead. static long wxGetTimeZone() { - long t; - _get_timezone(& t); + // The type of _get_timezone() parameter seems to have changed + // between VC8 and VC9. + #ifdef __VISUALC8__ + int t; + #else + long t; + #endif + _get_timezone(&t); return t; } #define WX_TIMEZONE wxGetTimeZone() - #elif 1 - // Solution (2): using GetTimeZoneInformation - static long wxGetTimeZone() - { - TIME_ZONE_INFORMATION tzi; - ::GetTimeZoneInformation(&tzi); - return tzi.Bias; // x 60 - } - #define WX_TIMEZONE wxGetTimeZone() - #else - // Old method using _timezone: this symbol doesn't exist in the dynamic run-time library (i.e. using /MD) - #define WX_TIMEZONE _timezone - #endif #else // unknown platform - try timezone #define WX_TIMEZONE timezone #endif