Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Unified Diff: src/date.h

Issue 525363002: Fix Date DST computation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/date.h
diff --git a/src/date.h b/src/date.h
index 633dd9f38e721668abbc80f9c262ef5111e44de6..2e5ce39a042c791de83a4446c960225a4784cf61 100644
--- a/src/date.h
+++ b/src/date.h
@@ -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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698