| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 // Time represents an absolute point in coordinated universal time (UTC), | 5 // Time represents an absolute point in coordinated universal time (UTC), |
| 6 // internally represented as microseconds (s/1,000,000) since the Windows epoch | 6 // internally represented as microseconds (s/1,000,000) since the Windows epoch |
| 7 // (1601-01-01 00:00:00 UTC) (See http://crbug.com/14734). System-dependent | 7 // (1601-01-01 00:00:00 UTC) (See http://crbug.com/14734). System-dependent |
| 8 // clock interface routines are defined in time_PLATFORM.cc. | 8 // clock interface routines are defined in time_PLATFORM.cc. |
| 9 // | 9 // |
| 10 // TimeDelta represents a duration of time, internally represented in | 10 // TimeDelta represents a duration of time, internally represented in |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 static const int64 kNanosecondsPerSecond = kNanosecondsPerMicrosecond * | 223 static const int64 kNanosecondsPerSecond = kNanosecondsPerMicrosecond * |
| 224 kMicrosecondsPerSecond; | 224 kMicrosecondsPerSecond; |
| 225 | 225 |
| 226 #if !defined(OS_WIN) | 226 #if !defined(OS_WIN) |
| 227 // On Mac & Linux, this value is the delta from the Windows epoch of 1601 to | 227 // On Mac & Linux, this value is the delta from the Windows epoch of 1601 to |
| 228 // the Posix delta of 1970. This is used for migrating between the old | 228 // the Posix delta of 1970. This is used for migrating between the old |
| 229 // 1970-based epochs to the new 1601-based ones. It should be removed from | 229 // 1970-based epochs to the new 1601-based ones. It should be removed from |
| 230 // this global header and put in the platform-specific ones when we remove the | 230 // this global header and put in the platform-specific ones when we remove the |
| 231 // migration code. | 231 // migration code. |
| 232 static const int64 kWindowsEpochDeltaMicroseconds; | 232 static const int64 kWindowsEpochDeltaMicroseconds; |
| 233 #else |
| 234 // To avoid overflow in QPC to Microseconds calculations, since we multiply |
| 235 // by kMicrosecondsPerSecond, then the QPC value should not exceed |
| 236 // (2^63 - 1) / 1E6. If it exceeds that threshold, we divide then multiply. |
| 237 static const int64 kQPCOverflowThreshold = 0x8637BD05AF7; |
| 233 #endif | 238 #endif |
| 234 | 239 |
| 235 // Represents an exploded time that can be formatted nicely. This is kind of | 240 // Represents an exploded time that can be formatted nicely. This is kind of |
| 236 // like the Win32 SYSTEMTIME structure or the Unix "struct tm" with a few | 241 // like the Win32 SYSTEMTIME structure or the Unix "struct tm" with a few |
| 237 // additions and changes to prevent errors. | 242 // additions and changes to prevent errors. |
| 238 struct BASE_EXPORT Exploded { | 243 struct BASE_EXPORT Exploded { |
| 239 int year; // Four digit year "2007" | 244 int year; // Four digit year "2007" |
| 240 int month; // 1-based month (values 1 = January, etc.) | 245 int month; // 1-based month (values 1 = January, etc.) |
| 241 int day_of_week; // 0-based day of week (0 = Sunday, etc.) | 246 int day_of_week; // 0-based day of week (0 = Sunday, etc.) |
| 242 int day_of_month; // 1-based day of month (1-31) | 247 int day_of_month; // 1-based day of month (1-31) |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 #endif | 743 #endif |
| 739 }; | 744 }; |
| 740 | 745 |
| 741 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 746 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
| 742 return TimeTicks(t.ticks_ + delta_); | 747 return TimeTicks(t.ticks_ + delta_); |
| 743 } | 748 } |
| 744 | 749 |
| 745 } // namespace base | 750 } // namespace base |
| 746 | 751 |
| 747 #endif // BASE_TIME_TIME_H_ | 752 #endif // BASE_TIME_TIME_H_ |
| OLD | NEW |