Title: [159892] trunk/Source/WTF
- Revision
- 159892
- Author
- [email protected]
- Date
- 2013-11-30 19:33:39 -0800 (Sat, 30 Nov 2013)
Log Message
[Win] Some _javascript_ date tests are failing.
https://bugs.webkit.org/show_bug.cgi?id=124946
Patch by [email protected] <[email protected]> on 2013-11-30
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.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (159891 => 159892)
--- trunk/Source/WTF/ChangeLog 2013-12-01 02:25:39 UTC (rev 159891)
+++ trunk/Source/WTF/ChangeLog 2013-12-01 03:33:39 UTC (rev 159892)
@@ -1,3 +1,16 @@
+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-28 Thiago de Barros Lacerda <[email protected]>
Nix Upstream: Updating Nix WTF files
Modified: trunk/Source/WTF/wtf/DateMath.cpp (159891 => 159892)
--- trunk/Source/WTF/wtf/DateMath.cpp 2013-12-01 02:25:39 UTC (rev 159891)
+++ trunk/Source/WTF/wtf/DateMath.cpp 2013-12-01 03:33:39 UTC (rev 159892)
@@ -411,6 +411,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.
*/
@@ -420,6 +433,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