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 | |
132 // ECMA 262 - 15.9.1.9 | 125 // ECMA 262 - 15.9.1.9 |
133 int64_t ToLocal(int64_t time_ms) { | 126 int64_t ToLocal(int64_t time_ms) { |
134 return time_ms + LocalOffsetInMs() + DaylightSavingsOffsetInMs(time_ms); | 127 return time_ms + LocalOffsetInMs() + DaylightSavingsOffsetInMs(time_ms); |
135 } | 128 } |
136 | 129 |
137 // ECMA 262 - 15.9.1.9 | 130 // ECMA 262 - 15.9.1.9 |
138 int64_t ToUTC(int64_t time_ms) { | 131 int64_t ToUTC(int64_t time_ms) { |
139 time_ms -= LocalOffsetInMs(); | 132 time_ms -= LocalOffsetInMs(); |
140 return time_ms - DaylightSavingsOffsetInMs(time_ms); | 133 return time_ms - DaylightSavingsOffsetInMs(time_ms); |
141 } | 134 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 bool ymd_valid_; | 251 bool ymd_valid_; |
259 int ymd_days_; | 252 int ymd_days_; |
260 int ymd_year_; | 253 int ymd_year_; |
261 int ymd_month_; | 254 int ymd_month_; |
262 int ymd_day_; | 255 int ymd_day_; |
263 }; | 256 }; |
264 | 257 |
265 } } // namespace v8::internal | 258 } } // namespace v8::internal |
266 | 259 |
267 #endif | 260 #endif |
OLD | NEW |