| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 183 } |
| 184 | 184 |
| 185 // Given the number of days since the epoch, computes | 185 // Given the number of days since the epoch, computes |
| 186 // the corresponding year, month, and day. | 186 // the corresponding year, month, and day. |
| 187 void YearMonthDayFromDays(int days, int* year, int* month, int* day); | 187 void YearMonthDayFromDays(int days, int* year, int* month, int* day); |
| 188 | 188 |
| 189 // Computes the number of days since the epoch for | 189 // Computes the number of days since the epoch for |
| 190 // the first day of the given month in the given year. | 190 // the first day of the given month in the given year. |
| 191 int DaysFromYearMonth(int year, int month); | 191 int DaysFromYearMonth(int year, int month); |
| 192 | 192 |
| 193 // Breaks down the time value. |
| 194 void BreakDownTime(int64_t time_ms, int* year, int* month, int* day, |
| 195 int* weekday, int* hour, int* min, int* sec, int* ms); |
| 196 |
| 193 // Cache stamp is used for invalidating caches in JSDate. | 197 // Cache stamp is used for invalidating caches in JSDate. |
| 194 // We increment the stamp each time when the timezone information changes. | 198 // We increment the stamp each time when the timezone information changes. |
| 195 // JSDate objects perform stamp check and invalidate their caches if | 199 // JSDate objects perform stamp check and invalidate their caches if |
| 196 // their saved stamp is not equal to the current stamp. | 200 // their saved stamp is not equal to the current stamp. |
| 197 Smi* stamp() { return stamp_; } | 201 Smi* stamp() { return stamp_; } |
| 198 void* stamp_address() { return &stamp_; } | 202 void* stamp_address() { return &stamp_; } |
| 199 | 203 |
| 200 // These functions are virtual so that we can override them when testing. | 204 // These functions are virtual so that we can override them when testing. |
| 201 virtual int GetDaylightSavingsOffsetFromOS(int64_t time_sec) { | 205 virtual int GetDaylightSavingsOffsetFromOS(int64_t time_sec) { |
| 202 double time_ms = static_cast<double>(time_sec * 1000); | 206 double time_ms = static_cast<double>(time_sec * 1000); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 int ymd_month_; | 277 int ymd_month_; |
| 274 int ymd_day_; | 278 int ymd_day_; |
| 275 | 279 |
| 276 base::TimezoneCache* tz_cache_; | 280 base::TimezoneCache* tz_cache_; |
| 277 }; | 281 }; |
| 278 | 282 |
| 279 } // namespace internal | 283 } // namespace internal |
| 280 } // namespace v8 | 284 } // namespace v8 |
| 281 | 285 |
| 282 #endif | 286 #endif |
| OLD | NEW |