Revision: 23606
Author: [email protected]
Date: Tue Sep 2 11:54:08 2014 UTC
Log: Fix Date DST computation.
BUG=v8:3116
LOG=N
[email protected]
Review URL: https://codereview.chromium.org/525363002
https://code.google.com/p/v8/source/detail?r=23606
Modified:
/branches/bleeding_edge/src/date.h
=======================================
--- /branches/bleeding_edge/src/date.h Mon Aug 4 11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/date.h Tue Sep 2 11:54:08 2014 UTC
@@ -103,14 +103,22 @@
}
// 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);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.