Bug 83436 - [WIN] Use GetDateFormat and GetTimeFormat instead of strftime
Summary: [WIN] Use GetDateFormat and GetTimeFormat instead of strftime
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: All Windows 7
: P2 Normal
Assignee: Patrick R. Gansterer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-08 12:17 PDT by Patrick R. Gansterer
Modified: 2012-07-23 00:54 PDT (History)
7 users (show)

See Also:


Attachments
Patch (4.77 KB, patch)
2012-04-08 12:23 PDT, Patrick R. Gansterer
aroben: review-
Details | Formatted Diff | Diff
Patch (4.98 KB, patch)
2012-05-30 14:18 PDT, Patrick R. Gansterer
bfulgham: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick R. Gansterer 2012-04-08 12:17:13 PDT
[WIN] Use GetDateFormat and GetTimeFormat instead of strftime
Comment 1 Patrick R. Gansterer 2012-04-08 12:23:13 PDT
Created attachment 136154 [details]
Patch
Comment 2 Adam Roben (:aroben) 2012-04-12 12:22:50 PDT
Comment on attachment 136154 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=136154&action=review

> Source/JavaScriptCore/runtime/DatePrototype.cpp:233
> +    UChar buffer[128];

How do we know this is long enough? Maybe we should use something like Vector<UChar, 128> and grow it if it turns out to be too small.
Comment 3 Patrick R. Gansterer 2012-05-30 14:18:47 PDT
Created attachment 144922 [details]
Patch
Comment 4 Brent Fulgham 2012-06-11 17:29:25 PDT
Comment on attachment 144922 [details]
Patch

Looks good to me!
Comment 5 Patrick R. Gansterer 2012-07-21 14:23:00 PDT
Committed r123293: <http://trac.webkit.org/changeset/123293>
Comment 6 yosin 2012-07-22 20:51:07 PDT
FYI:

GetTimeFormat works only for year 1601 to 320827.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724950(v=vs.85).aspx

It doesn't cover full JavaScript Date range.
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/

GetTimeFormat also doesn't work with HTML5 Date range. So, we implemented formatDate for Windows in WebCore.
http://trac.webkit.org/browser/trunk/Source/WebCore/platform/text/LocaleWin.cpp
Comment 7 Patrick R. Gansterer 2012-07-23 00:54:31 PDT
(In reply to comment #6)
> GetTimeFormat works only for year 1601 to 320827.
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms724950(v=vs.85).aspx

Yes, but the current call to strftime() does not even return correct values for dates before 1900 on my windows 7 machine with VS2010.