Title: [123317] trunk/Source/WTF
- Revision
- 123317
- Author
- [email protected]
- Date
- 2012-07-23 01:34:19 -0700 (Mon, 23 Jul 2012)
Log Message
[WIN] Use GetTimeZoneInformation() for calculateUTCOffset()
https://bugs.webkit.org/show_bug.cgi?id=91935
Reviewed by Ryosuke Niwa.
GetTimeZoneInformation() returns the offset directly. Using it
avoids unnecessary calculations and remove dependencies on
other time related function, which do not exist on WinCE.
* wtf/DateMath.cpp:
(WTF::calculateUTCOffset):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (123316 => 123317)
--- trunk/Source/WTF/ChangeLog 2012-07-23 08:33:26 UTC (rev 123316)
+++ trunk/Source/WTF/ChangeLog 2012-07-23 08:34:19 UTC (rev 123317)
@@ -1,3 +1,17 @@
+2012-07-23 Patrick Gansterer <[email protected]>
+
+ [WIN] Use GetTimeZoneInformation() for calculateUTCOffset()
+ https://bugs.webkit.org/show_bug.cgi?id=91935
+
+ Reviewed by Ryosuke Niwa.
+
+ GetTimeZoneInformation() returns the offset directly. Using it
+ avoids unnecessary calculations and remove dependencies on
+ other time related function, which do not exist on WinCE.
+
+ * wtf/DateMath.cpp:
+ (WTF::calculateUTCOffset):
+
2012-07-20 Han Shen <[email protected]>
[Chromium] Compilation fails under gcc 4.7
Modified: trunk/Source/WTF/wtf/DateMath.cpp (123316 => 123317)
--- trunk/Source/WTF/wtf/DateMath.cpp 2012-07-23 08:33:26 UTC (rev 123316)
+++ trunk/Source/WTF/wtf/DateMath.cpp 2012-07-23 08:34:19 UTC (rev 123317)
@@ -356,6 +356,12 @@
int32_t calculateUTCOffset()
{
+#if OS(WINDOWS)
+ TIME_ZONE_INFORMATION timeZoneInformation;
+ GetTimeZoneInformation(&timeZoneInformation);
+ int32_t bias = timeZoneInformation.Bias + timeZoneInformation.StandardBias;
+ return -bias * 60 * 1000;
+#else
time_t localTime = time(0);
tm localt;
getLocalTime(&localTime, &localt);
@@ -376,7 +382,7 @@
#if HAVE(TM_ZONE)
localt.tm_zone = 0;
#endif
-
+
#if HAVE(TIMEGM)
time_t utcOffset = timegm(&localt) - mktime(&localt);
#else
@@ -386,6 +392,7 @@
#endif
return static_cast<int32_t>(utcOffset * 1000);
+#endif
}
/*
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes