]> git.saurik.com Git - wxWidgets.git/commitdiff
Use SYSTEMTIME instead of DOS time when converting to/from VARIANTS.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 6 Sep 2009 14:31:10 +0000 (14:31 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 6 Sep 2009 14:31:10 +0000 (14:31 +0000)
SYSTEMTIME has a much larger range than DOS time and a much better precision
(1ms instead of 2s) as well.

Closes #11177.

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

src/msw/ole/automtn.cpp

index 31348b791a723686905918a67a14491bf59641cf..127b52b527d9626fca2c4af01e72b9064df5e5f4 100644 (file)
@@ -606,11 +606,10 @@ WXDLLEXPORT bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& ole
         wxDateTime date( variant.GetDateTime() );
         oleVariant.vt = VT_DATE;
 
-        long dosDateTime = date.GetAsDOS();
-        short dosDate = short((dosDateTime & 0xFFFF0000) >> 16);
-        short dosTime = short(dosDateTime & 0xFFFF);
+        SYSTEMTIME st;
+        date.GetAsMSWSysTime(&st);
 
-        DosDateTimeToVariantTime(dosDate, dosTime, & oleVariant.date);
+        SystemTimeToVariantTime(&st, &oleVariant.date);
     }
 #endif
     else if (type == wxT("void*"))
@@ -772,13 +771,11 @@ wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant)
             case VT_DATE:
 #if wxUSE_DATETIME
                 {
-                    unsigned short dosDate = 0;
-                    unsigned short dosTime = 0;
-                    VariantTimeToDosDateTime(oleVariant.date, & dosDate, & dosTime);
+                    SYSTEMTIME st;
+                    VariantTimeToSystemTime(oleVariant.date, &st);
 
-                    long dosDateTime = (dosDate << 16) | dosTime;
                     wxDateTime date;
-                    date.SetFromDOS(dosDateTime);
+                    date.SetFromMSWSysTime(st);
                     variant = date;
                 }
 #endif // wxUSE_DATETIME