Title: [160376] branches/safari-537.74-branch/Source/WTF
Revision
160376
Author
[email protected]
Date
2013-12-10 11:29:43 -0800 (Tue, 10 Dec 2013)

Log Message

Merge r159892

Modified Paths

Diff

Modified: branches/safari-537.74-branch/Source/WTF/ChangeLog (160375 => 160376)


--- branches/safari-537.74-branch/Source/WTF/ChangeLog	2013-12-10 18:54:40 UTC (rev 160375)
+++ branches/safari-537.74-branch/Source/WTF/ChangeLog	2013-12-10 19:29:43 UTC (rev 160376)
@@ -1,3 +1,20 @@
+2013-12-10  Matthew Hanson  <[email protected]>
+
+        Merge r159892
+
+    2013-11-30  [email protected]  <[email protected]>
+
+            [Win] Some _javascript_ date tests are failing.
+            https://bugs.webkit.org/show_bug.cgi?id=124946
+
+            Reviewed by Brent Fulgham.
+
+            Use native Win32 api functions to compute Daylight saving time offset.
+
+            * wtf/DateMath.cpp:
+            (WTF::UnixTimeToFileTime): Added method to calculate Win32 specific struct FILETIME from time_t value.
+            (WTF::calculateDSTOffset): Use native Win32 api functions to compute Daylight saving time offset.
+
 2013-11-04  Lucas Forschler  <[email protected]>
 
         Merge r158602

Modified: branches/safari-537.74-branch/Source/WTF/wtf/DateMath.cpp (160375 => 160376)


--- branches/safari-537.74-branch/Source/WTF/wtf/DateMath.cpp	2013-12-10 18:54:40 UTC (rev 160375)
+++ branches/safari-537.74-branch/Source/WTF/wtf/DateMath.cpp	2013-12-10 19:29:43 UTC (rev 160376)
@@ -417,6 +417,19 @@
 #endif
 }
 
+#if OS(WINDOWS)
+// Code taken from http://support.microsoft.com/kb/167296
+static void UnixTimeToFileTime(time_t t, LPFILETIME pft)
+{
+    // Note that LONGLONG is a 64-bit value
+    LONGLONG ll;
+
+    ll = Int32x32To64(t, 10000000) + 116444736000000000;
+    pft->dwLowDateTime = (DWORD)ll;
+    pft->dwHighDateTime = ll >> 32;
+}
+#endif
+
 /*
  * Get the DST offset for the time passed in.
  */
@@ -426,6 +439,22 @@
     UNUSED_PARAM(localTime);
     UNUSED_PARAM(utcOffset);
     return 0;
+#elif OS(WINDOWS)
+    FILETIME utcFileTime;
+    UnixTimeToFileTime(localTime, &utcFileTime);
+    SYSTEMTIME utcSystemTime, localSystemTime;
+    FileTimeToSystemTime(&utcFileTime, &utcSystemTime);
+    SystemTimeToTzSpecificLocalTime(0, &utcSystemTime, &localSystemTime);
+
+    double offsetTime = (localTime * msPerSecond) + utcOffset;
+
+    // Offset from UTC but doesn't include DST obviously
+    int offsetHour =  msToHours(offsetTime);
+    int offsetMinute =  msToMinutes(offsetTime);
+
+    double diff = ((localSystemTime.wHour - offsetHour) * secondsPerHour) + ((localSystemTime.wMinute - offsetMinute) * 60);
+
+    return diff * msPerSecond;
 #else
     //input is UTC so we have to shift back to local time to determine DST thus the + getUTCOffset()
     double offsetTime = (localTime * msPerSecond) + utcOffset;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to