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

Unified Diff: src/date.js

Issue 1543008: Update the time zone offset and dst offset when time zone name changes. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 | « 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.js
===================================================================
--- src/date.js (revision 4331)
+++ src/date.js (working copy)
@@ -588,6 +588,20 @@
function LocalTimezoneString(time) {
+ var old_timezone = timezone_cache_timezone;
+ var timezone = LocalTimezone(time);
+ if (old_timezone && timezone != old_timezone) {
+ // If the timezone string has changed from the one that we cached,
+ // the local time offset may now be wrong. So we need to update it
+ // and try again.
+ local_time_offset = %DateLocalTimeOffset();
+ // We also need to invalidate the DST cache as the new timezone may have
+ // different DST times.
+ var dst_cache = DST_offset_cache;
+ dst_cache.start = 0;
+ dst_cache.end = -1;
+ }
+
var timezoneOffset =
(DaylightSavingsOffset(time) + local_time_offset) / msPerMinute;
var sign = (timezoneOffset >= 0) ? 1 : -1;
@@ -595,7 +609,7 @@
var min = FLOOR((sign * timezoneOffset)%60);
var gmt = ' GMT' + ((sign == 1) ? '+' : '-') +
TwoDigitString(hours) + TwoDigitString(min);
- return gmt + ' (' + LocalTimezone(time) + ')';
+ return gmt + ' (' + timezone + ')';
}
« 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