Commit 1823ae01 authored by ulan@chromium.org's avatar ulan@chromium.org

Fix Date DST computation.

BUG=v8:3116
LOG=N
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/525363002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23606 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 946a2564
......@@ -103,14 +103,22 @@ class DateCache {
}
// ECMA 262 - 15.9.1.9
// LocalTime(t) = t + LocalTZA + DaylightSavingTA(t)
// ECMA 262 assumes that DaylightSavingTA is computed using UTC time,
// but we fetch DST from OS using local time, therefore we need:
// LocalTime(t) = t + LocalTZA + DaylightSavingTA(t + LocalTZA).
int64_t ToLocal(int64_t time_ms) {
return time_ms + LocalOffsetInMs() + DaylightSavingsOffsetInMs(time_ms);
time_ms += LocalOffsetInMs();
return time_ms + DaylightSavingsOffsetInMs(time_ms);
}
// ECMA 262 - 15.9.1.9
// UTC(t) = t - LocalTZA - DaylightSavingTA(t - LocalTZA)
// ECMA 262 assumes that DaylightSavingTA is computed using UTC time,
// but we fetch DST from OS using local time, therefore we need:
// UTC(t) = t - LocalTZA - DaylightSavingTA(t).
int64_t ToUTC(int64_t time_ms) {
time_ms -= LocalOffsetInMs();
return time_ms - DaylightSavingsOffsetInMs(time_ms);
return time_ms - LocalOffsetInMs() - DaylightSavingsOffsetInMs(time_ms);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment