Bug 7107 - Refactor Date object to provide direct access to milliseconds/offset
Summary: Refactor Date object to provide direct access to milliseconds/offset
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords:
Depends on:
Blocks: 7012
  Show dependency treegraph
 
Reported: 2006-02-06 11:14 PST by Alexey Proskuryakov
Modified: 2006-02-07 02:13 PST (History)
0 users

See Also:


Attachments
proposed patch (10.13 KB, patch)
2006-02-06 11:31 PST, Alexey Proskuryakov
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2006-02-06 11:14:17 PST
This is needed to convert JavaScript dates to AppleScript ones in WebCore.
Comment 1 Alexey Proskuryakov 2006-02-06 11:31:18 PST
Created attachment 6294 [details]
proposed patch

While refactoring the code, I had to also make several Windows-specific changes.

Apparently, the Windows _daylight global has a different meaning than seems to have been expected by GetTimezoneOffset implementation. In fact, _daylight is non-zero if the machine is configured to support daylight savings time, not when DST is active. In other words, there are two ways to make _daylight non-zero:
1) Tick "Automatically adjust clock for daylight saving changes" checkbox in Date and Time control panel - _daylight becomes 1 (the actual value is undocumented).
2) give TZ environment variable a value that includes a DST timezone. E.g.:
set TZ=MSK3  -> _daylight=0
set TZ=MSK3MSD  -> _daylight=77 (value depends on the timezone, also undocumented).
Comment 2 Darin Adler 2006-02-06 18:18:56 PST
Comment on attachment 6294 [details]
proposed patch

+static bool isTime_tSigned()
+{
+    time_t minusOne = (time_t)(-1);
+    return minusOne < 0;
+}

The above function should be marked inline, because if so it will act as a compile-time constant.

If tested thoroughly, looks good, r=me.