| OLD | NEW |
| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 var DST_offset_cache = { | 143 var DST_offset_cache = { |
| 144 // Cached DST offset. | 144 // Cached DST offset. |
| 145 offset: 0, | 145 offset: 0, |
| 146 // Time interval where the cached offset is valid. | 146 // Time interval where the cached offset is valid. |
| 147 start: 0, end: -1, | 147 start: 0, end: -1, |
| 148 // Size of next interval expansion. | 148 // Size of next interval expansion. |
| 149 increment: 0 | 149 increment: 0 |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 | 152 |
| 153 // NOTE: The implementation relies on the fact that no time zones have |
| 154 // more than one daylight savings offset change per month. |
| 153 function DaylightSavingsOffset(t) { | 155 function DaylightSavingsOffset(t) { |
| 154 // Load the cache object from the builtins object. | 156 // Load the cache object from the builtins object. |
| 155 var cache = DST_offset_cache; | 157 var cache = DST_offset_cache; |
| 156 | 158 |
| 157 // Cache the start and the end in local variables for fast access. | 159 // Cache the start and the end in local variables for fast access. |
| 158 var start = cache.start; | 160 var start = cache.start; |
| 159 var end = cache.end; | 161 var end = cache.end; |
| 160 | 162 |
| 161 if (start <= t) { | 163 if (start <= t) { |
| 162 // If the time fits in the cached interval, return the cached offset. | 164 // If the time fits in the cached interval, return the cached offset. |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 function GetUTCHoursFrom(aDate) { | 525 function GetUTCHoursFrom(aDate) { |
| 524 var t = GetTimeFrom(aDate); | 526 var t = GetTimeFrom(aDate); |
| 525 if ($isNaN(t)) return t; | 527 if ($isNaN(t)) return t; |
| 526 return HourFromTime(t); | 528 return HourFromTime(t); |
| 527 } | 529 } |
| 528 | 530 |
| 529 | 531 |
| 530 function GetFullYearFrom(aDate) { | 532 function GetFullYearFrom(aDate) { |
| 531 var t = GetTimeFrom(aDate); | 533 var t = GetTimeFrom(aDate); |
| 532 if ($isNaN(t)) return t; | 534 if ($isNaN(t)) return t; |
| 533 return YearFromTime(LocalTimeNoCheck(t)); | 535 // Ignore the DST offset for year computations. |
| 536 return YearFromTime(t + local_time_offset); |
| 534 } | 537 } |
| 535 | 538 |
| 536 | 539 |
| 537 function GetUTCFullYearFrom(aDate) { | 540 function GetUTCFullYearFrom(aDate) { |
| 538 var t = GetTimeFrom(aDate); | 541 var t = GetTimeFrom(aDate); |
| 539 if ($isNaN(t)) return t; | 542 if ($isNaN(t)) return t; |
| 540 return YearFromTime(t); | 543 return YearFromTime(t); |
| 541 } | 544 } |
| 542 | 545 |
| 543 | 546 |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 "toGMTString", DateToGMTString, | 1125 "toGMTString", DateToGMTString, |
| 1123 "toUTCString", DateToUTCString, | 1126 "toUTCString", DateToUTCString, |
| 1124 "getYear", DateGetYear, | 1127 "getYear", DateGetYear, |
| 1125 "setYear", DateSetYear, | 1128 "setYear", DateSetYear, |
| 1126 "toISOString", DateToISOString, | 1129 "toISOString", DateToISOString, |
| 1127 "toJSON", DateToJSON | 1130 "toJSON", DateToJSON |
| 1128 )); | 1131 )); |
| 1129 } | 1132 } |
| 1130 | 1133 |
| 1131 SetupDate(); | 1134 SetupDate(); |
| OLD | NEW |