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

Unified Diff: src/date.js

Issue 173793002: Check and clear date cache in DateCurrentTime, DateLocalTimezone and getTimezoneOffset. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix caching of offset Created 6 years, 9 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 | « src/date.h ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/date.js
diff --git a/src/date.js b/src/date.js
index f3d4af244f9692c223ee5b467ace6c52e177d46f..5e3f5c1a5ebd896fc9443e00c739058c68e0da3b 100644
--- a/src/date.js
+++ b/src/date.js
@@ -42,16 +42,19 @@ function ThrowDateTypeError() {
var timezone_cache_time = NAN;
+var timezone_cache_timezone_offset = NAN;
var timezone_cache_timezone;
-function LocalTimezone(t) {
+function LocalTimezone(t, timezone_offset) {
if (NUMBER_IS_NAN(t)) return "";
- if (t == timezone_cache_time) {
+ if (t == timezone_cache_time &&
+ timezone_offset == timezone_cache_timezone_offset) {
return timezone_cache_timezone;
}
var timezone = %DateLocalTimezone(t);
timezone_cache_time = t;
timezone_cache_timezone = timezone;
+ timezone_cache_timezone_offset = timezone_offset;
return timezone;
}
@@ -245,9 +248,8 @@ function TimeStringUTC(date) {
function LocalTimezoneString(date) {
- var timezone = LocalTimezone(UTC_DATE_VALUE(date));
-
var timezoneOffset = -TIMEZONE_OFFSET(date);
+ var timezone = LocalTimezone(UTC_DATE_VALUE(date), timezoneOffset);
var sign = (timezoneOffset >= 0) ? 1 : -1;
var hours = FLOOR((sign * timezoneOffset)/60);
var min = FLOOR((sign * timezoneOffset)%60);
« no previous file with comments | « src/date.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698