]> git.saurik.com Git - wxWidgets.git/commitdiff
Use _get_timezone() function instead of _timezone with MSVC8+.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 2 Nov 2010 11:57:30 +0000 (11:57 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 2 Nov 2010 11:57:30 +0000 (11:57 +0000)
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

src/common/datetime.cpp

index 4e0ea0fa695c62d92b6b2255bec838dbc48e6c70..4bbca2e476758bc7548f67b260bb58ac744fd159 100644 (file)
@@ -137,30 +137,22 @@ wxCUSTOM_TYPE_INFO(wxDateTime, wxToStringConverter<wxDateTime> , 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