OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 return OS::LocalTimezone(static_cast<double>(time_ms)); | 116 return OS::LocalTimezone(static_cast<double>(time_ms)); |
117 } | 117 } |
118 | 118 |
119 // ECMA 262 - 15.9.5.26 | 119 // ECMA 262 - 15.9.5.26 |
120 int TimezoneOffset(int64_t time_ms) { | 120 int TimezoneOffset(int64_t time_ms) { |
121 int64_t local_ms = ToLocal(time_ms); | 121 int64_t local_ms = ToLocal(time_ms); |
122 return static_cast<int>((time_ms - local_ms) / kMsPerMin); | 122 return static_cast<int>((time_ms - local_ms) / kMsPerMin); |
123 } | 123 } |
124 | 124 |
| 125 void CheckTimezone() { |
| 126 if (local_offset_ms_ != kInvalidLocalOffsetInMs && |
| 127 local_offset_ms_ != GetLocalOffsetFromOS()) { |
| 128 ResetDateCache(); |
| 129 } |
| 130 } |
| 131 |
125 // ECMA 262 - 15.9.1.9 | 132 // ECMA 262 - 15.9.1.9 |
126 int64_t ToLocal(int64_t time_ms) { | 133 int64_t ToLocal(int64_t time_ms) { |
127 return time_ms + LocalOffsetInMs() + DaylightSavingsOffsetInMs(time_ms); | 134 return time_ms + LocalOffsetInMs() + DaylightSavingsOffsetInMs(time_ms); |
128 } | 135 } |
129 | 136 |
130 // ECMA 262 - 15.9.1.9 | 137 // ECMA 262 - 15.9.1.9 |
131 int64_t ToUTC(int64_t time_ms) { | 138 int64_t ToUTC(int64_t time_ms) { |
132 time_ms -= LocalOffsetInMs(); | 139 time_ms -= LocalOffsetInMs(); |
133 return time_ms - DaylightSavingsOffsetInMs(time_ms); | 140 return time_ms - DaylightSavingsOffsetInMs(time_ms); |
134 } | 141 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 bool ymd_valid_; | 258 bool ymd_valid_; |
252 int ymd_days_; | 259 int ymd_days_; |
253 int ymd_year_; | 260 int ymd_year_; |
254 int ymd_month_; | 261 int ymd_month_; |
255 int ymd_day_; | 262 int ymd_day_; |
256 }; | 263 }; |
257 | 264 |
258 } } // namespace v8::internal | 265 } } // namespace v8::internal |
259 | 266 |
260 #endif | 267 #endif |
OLD | NEW |