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

Side by Side 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, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 581
582 582
583 function TimeString(time) { 583 function TimeString(time) {
584 return TwoDigitString(HOUR_FROM_TIME(time)) + ':' 584 return TwoDigitString(HOUR_FROM_TIME(time)) + ':'
585 + TwoDigitString(MIN_FROM_TIME(time)) + ':' 585 + TwoDigitString(MIN_FROM_TIME(time)) + ':'
586 + TwoDigitString(SEC_FROM_TIME(time)); 586 + TwoDigitString(SEC_FROM_TIME(time));
587 } 587 }
588 588
589 589
590 function LocalTimezoneString(time) { 590 function LocalTimezoneString(time) {
591 var old_timezone = timezone_cache_timezone;
592 var timezone = LocalTimezone(time);
593 if (old_timezone && timezone != old_timezone) {
594 // If the timezone string has changed from the one that we cached,
595 // the local time offset may now be wrong. So we need to update it
596 // and try again.
597 local_time_offset = %DateLocalTimeOffset();
598 // We also need to invalidate the DST cache as the new timezone may have
599 // different DST times.
600 var dst_cache = DST_offset_cache;
601 dst_cache.start = 0;
602 dst_cache.end = -1;
603 }
604
591 var timezoneOffset = 605 var timezoneOffset =
592 (DaylightSavingsOffset(time) + local_time_offset) / msPerMinute; 606 (DaylightSavingsOffset(time) + local_time_offset) / msPerMinute;
593 var sign = (timezoneOffset >= 0) ? 1 : -1; 607 var sign = (timezoneOffset >= 0) ? 1 : -1;
594 var hours = FLOOR((sign * timezoneOffset)/60); 608 var hours = FLOOR((sign * timezoneOffset)/60);
595 var min = FLOOR((sign * timezoneOffset)%60); 609 var min = FLOOR((sign * timezoneOffset)%60);
596 var gmt = ' GMT' + ((sign == 1) ? '+' : '-') + 610 var gmt = ' GMT' + ((sign == 1) ? '+' : '-') +
597 TwoDigitString(hours) + TwoDigitString(min); 611 TwoDigitString(hours) + TwoDigitString(min);
598 return gmt + ' (' + LocalTimezone(time) + ')'; 612 return gmt + ' (' + timezone + ')';
599 } 613 }
600 614
601 615
602 function DatePrintString(time) { 616 function DatePrintString(time) {
603 return DateString(time) + ' ' + TimeString(time); 617 return DateString(time) + ' ' + TimeString(time);
604 } 618 }
605 619
606 // ------------------------------------------------------------------- 620 // -------------------------------------------------------------------
607 621
608 // Reused output buffer. Used when parsing date strings. 622 // Reused output buffer. Used when parsing date strings.
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 "toGMTString", DateToGMTString, 1118 "toGMTString", DateToGMTString,
1105 "toUTCString", DateToUTCString, 1119 "toUTCString", DateToUTCString,
1106 "getYear", DateGetYear, 1120 "getYear", DateGetYear,
1107 "setYear", DateSetYear, 1121 "setYear", DateSetYear,
1108 "toISOString", DateToISOString, 1122 "toISOString", DateToISOString,
1109 "toJSON", DateToJSON 1123 "toJSON", DateToJSON
1110 )); 1124 ));
1111 } 1125 }
1112 1126
1113 SetupDate(); 1127 SetupDate();
OLDNEW
« 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