OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_DATE_H_ | 5 #ifndef V8_DATE_H_ |
6 #define V8_DATE_H_ | 6 #define V8_DATE_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 // These functions are virtual so that we can override them when testing. | 162 // These functions are virtual so that we can override them when testing. |
163 virtual int GetDaylightSavingsOffsetFromOS(int64_t time_sec) { | 163 virtual int GetDaylightSavingsOffsetFromOS(int64_t time_sec) { |
164 double time_ms = static_cast<double>(time_sec * 1000); | 164 double time_ms = static_cast<double>(time_sec * 1000); |
165 return static_cast<int>( | 165 return static_cast<int>( |
166 base::OS::DaylightSavingsOffset(time_ms, tz_cache_)); | 166 base::OS::DaylightSavingsOffset(time_ms, tz_cache_)); |
167 } | 167 } |
168 | 168 |
169 virtual int GetLocalOffsetFromOS() { | 169 virtual int GetLocalOffsetFromOS() { |
170 double offset = base::OS::LocalTimeOffset(tz_cache_); | 170 double offset = base::OS::LocalTimeOffset(tz_cache_); |
171 ASSERT(offset < kInvalidLocalOffsetInMs); | 171 DCHECK(offset < kInvalidLocalOffsetInMs); |
172 return static_cast<int>(offset); | 172 return static_cast<int>(offset); |
173 } | 173 } |
174 | 174 |
175 private: | 175 private: |
176 // The implementation relies on the fact that no time zones have | 176 // The implementation relies on the fact that no time zones have |
177 // more than one daylight savings offset change per 19 days. | 177 // more than one daylight savings offset change per 19 days. |
178 // In Egypt in 2010 they decided to suspend DST during Ramadan. This | 178 // In Egypt in 2010 they decided to suspend DST during Ramadan. This |
179 // led to a short interval where DST is in effect from September 10 to | 179 // led to a short interval where DST is in effect from September 10 to |
180 // September 30. | 180 // September 30. |
181 static const int kDefaultDSTDeltaInSec = 19 * kSecPerDay; | 181 static const int kDefaultDSTDeltaInSec = 19 * kSecPerDay; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 int ymd_year_; | 234 int ymd_year_; |
235 int ymd_month_; | 235 int ymd_month_; |
236 int ymd_day_; | 236 int ymd_day_; |
237 | 237 |
238 base::TimezoneCache* tz_cache_; | 238 base::TimezoneCache* tz_cache_; |
239 }; | 239 }; |
240 | 240 |
241 } } // namespace v8::internal | 241 } } // namespace v8::internal |
242 | 242 |
243 #endif | 243 #endif |
OLD | NEW |