Commit 9738049a authored by whesse@chromium.org's avatar whesse@chromium.org

Update the time zone offset and dst offset when time zone name changes.

Review URL: http://codereview.chromium.org/1543008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4332 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4db34007
......@@ -588,6 +588,20 @@ function TimeString(time) {
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 @@ function LocalTimezoneString(time) {
var min = FLOOR((sign * timezoneOffset)%60);
var gmt = ' GMT' + ((sign == 1) ? '+' : '-') +
TwoDigitString(hours) + TwoDigitString(min);
return gmt + ' (' + LocalTimezone(time) + ')';
return gmt + ' (' + timezone + ')';
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment