Title: [125004] trunk/Source/_javascript_Core
Revision
125004
Author
par...@webkit.org
Date
2012-08-08 00:31:12 -0700 (Wed, 08 Aug 2012)

Log Message

[WIN] Use GetTimeZoneInformation() for getting the timezone name
https://bugs.webkit.org/show_bug.cgi?id=91936

Reviewed by Ryosuke Niwa.

The MS CRT implementation of strftime calls the same functions in the background.
Using them directly avoids the overhead of parsing the format string and removes
the dependency on strftime() for WinCE where this function does not exist.

* runtime/DateConversion.cpp:
(JSC::formatTime):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (125003 => 125004)


--- trunk/Source/_javascript_Core/ChangeLog	2012-08-08 07:13:36 UTC (rev 125003)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-08-08 07:31:12 UTC (rev 125004)
@@ -1,3 +1,17 @@
+2012-08-08  Patrick Gansterer  <par...@webkit.org>
+
+        [WIN] Use GetTimeZoneInformation() for getting the timezone name
+        https://bugs.webkit.org/show_bug.cgi?id=91936
+
+        Reviewed by Ryosuke Niwa.
+
+        The MS CRT implementation of strftime calls the same functions in the background.
+        Using them directly avoids the overhead of parsing the format string and removes
+        the dependency on strftime() for WinCE where this function does not exist.
+
+        * runtime/DateConversion.cpp:
+        (JSC::formatTime):
+
 2012-08-07  Gabor Ballabas  <gab...@inf.u-szeged.hu>
 
         Refactor magic numbers in the ARM port of DFG-JIT

Modified: trunk/Source/_javascript_Core/runtime/DateConversion.cpp (125003 => 125004)


--- trunk/Source/_javascript_Core/runtime/DateConversion.cpp	2012-08-08 07:13:36 UTC (rev 125003)
+++ trunk/Source/_javascript_Core/runtime/DateConversion.cpp	2012-08-08 07:31:12 UTC (rev 125004)
@@ -30,6 +30,10 @@
 #include <wtf/DateMath.h>
 #include <wtf/text/StringBuilder.h>
 
+#if OS(WINDOWS)
+#include <windows.h>
+#endif
+
 using namespace WTF;
 
 namespace JSC {
@@ -100,9 +104,15 @@
             appendNumber<2>(builder, offset / 60);
             appendNumber<2>(builder, offset % 60);
 
+#if OS(WINDOWS)
+            TIME_ZONE_INFORMATION timeZoneInformation;
+            GetTimeZoneInformation(&timeZoneInformation);
+            const WCHAR* timeZoneName = t.isDST() ? timeZoneInformation.DaylightName : timeZoneInformation.StandardName;
+#else
             struct tm gtm = t;
             char timeZoneName[70];
             strftime(timeZoneName, sizeof(timeZoneName), "%Z", &gtm);
+#endif
             if (timeZoneName[0]) {
                 builder.append(" (");
                 builder.append(timeZoneName);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to