]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 1232933 ] [WinCE] wxDateTime incorrect reading
authorJulian Smart <julian@anthemion.co.uk>
Fri, 9 Sep 2005 20:49:05 +0000 (20:49 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 9 Sep 2005 20:49:05 +0000 (20:49 +0000)
By bastekx - eba_k

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35453 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/wince/time.cpp

index aaab3ce887ab9dd21ea0c8ac97b2d26a3c4daae1..7587b3bdbee39d647a9c343a67990b5dcf4a632f 100644 (file)
@@ -52,8 +52,11 @@ long timezone ; // global variable
 ////////////////////////////////////////////////////////////////////////
 // Common code for localtime and gmtime (static)
 ////////////////////////////////////////////////////////////////////////
-static struct tm * __cdecl common_localtime(const time_t * WXUNUSED(t), BOOL bLocal)
+
+static struct tm * __cdecl common_localtime(const time_t *t, BOOL bLocal)
 {
+    wxLongLong i64;
+    FILETIME   ft;
     wxString str ;
     SYSTEMTIME SystemTime;
     TIME_ZONE_INFORMATION pTz;
@@ -68,7 +71,19 @@ static struct tm * __cdecl common_localtime(const time_t * WXUNUSED(t), BOOL bLo
         { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
     };
 
-    ::GetLocalTime(&SystemTime) ;
+    if (!*t)
+        ::GetLocalTime(&SystemTime);
+    else
+    {
+        i64 = *t;
+        i64 = i64 * 10000000 + 116444736000000000;
+
+        ft.dwLowDateTime  = i64.GetLo();
+        ft.dwHighDateTime = i64.GetHi();
+
+        ::FileTimeToSystemTime(&ft, &SystemTime);
+    }
+
     ::GetTimeZoneInformation(&pTz);
 
     ///////////////////////////////////////////////