Ignore:
Timestamp:
Aug 8, 2012, 12:31:12 AM (13 years ago)
Author:
Patrick Gansterer
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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/DateConversion.cpp

    r124817 r125004  
    3030#include <wtf/DateMath.h>
    3131#include <wtf/text/StringBuilder.h>
     32
     33#if OS(WINDOWS)
     34#include <windows.h>
     35#endif
    3236
    3337using namespace WTF;
     
    101105            appendNumber<2>(builder, offset % 60);
    102106
     107#if OS(WINDOWS)
     108            TIME_ZONE_INFORMATION timeZoneInformation;
     109            GetTimeZoneInformation(&timeZoneInformation);
     110            const WCHAR* timeZoneName = t.isDST() ? timeZoneInformation.DaylightName : timeZoneInformation.StandardName;
     111#else
    103112            struct tm gtm = t;
    104113            char timeZoneName[70];
    105114            strftime(timeZoneName, sizeof(timeZoneName), "%Z", &gtm);
     115#endif
    106116            if (timeZoneName[0]) {
    107117                builder.append(" (");
Note: See TracChangeset for help on using the changeset viewer.