From 5ad7734a71502ce86e166ba7259302a8293a5e36 Mon Sep 17 00:00:00 2001 From: "ager@chromium.org" Date: Wed, 18 Aug 2010 07:01:07 +0000 Subject: [PATCH] Decrease the DST cache increment to take into account the suspension of DST in Egypt during Ramadan 2010. Review URL: http://codereview.chromium.org/3122025 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5289 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/date.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/date.js b/src/date.js index 9c42a04..b101ea6 100644 --- a/src/date.js +++ b/src/date.js @@ -137,12 +137,18 @@ var DST_offset_cache = { // Time interval where the cached offset is valid. start: 0, end: -1, // Size of next interval expansion. - increment: 0 + increment: 0, + initial_increment: 19 * msPerDay }; // NOTE: The implementation relies on the fact that no time zones have -// more than one daylight savings offset change per month. +// more than one daylight savings offset change per 19 days. +// +// In Egypt in 2010 they decided to suspend DST during Ramadan. This +// led to a short interval where DST is in effect from September 10 to +// September 30. +// // If this function is called with NaN it returns NaN. function DaylightSavingsOffset(t) { // Load the cache object from the builtins object. @@ -171,7 +177,7 @@ function DaylightSavingsOffset(t) { // the offset in the cache, we grow the cached time interval // and return the offset. cache.end = new_end; - cache.increment = msPerMonth; + cache.increment = cache.initial_increment; return end_offset; } else { var offset = %DateDaylightSavingsOffset(EquivalentTime(t)); @@ -182,7 +188,7 @@ function DaylightSavingsOffset(t) { // the interval to reflect this and reset the increment. cache.start = t; cache.end = new_end; - cache.increment = msPerMonth; + cache.increment = cache.initial_increment; } else { // The interval contains a DST offset change and the given time is // before it. Adjust the increment to avoid a linear search for @@ -207,7 +213,7 @@ function DaylightSavingsOffset(t) { var offset = %DateDaylightSavingsOffset(EquivalentTime(t)); cache.offset = offset; cache.start = cache.end = t; - cache.increment = msPerMonth; + cache.increment = cache.initial_increment; return offset; } -- 2.7.4