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). System-dependent clock interface routines are | 7 // (1601-01-01 00:00:00 UTC). System-dependent clock interface routines are |
8 // defined in time_PLATFORM.cc. Note that values for Time may skew and jump | 8 // defined in time_PLATFORM.cc. Note that values for Time may skew and jump |
9 // around as the operating system makes adjustments to synchronize (e.g., with | 9 // around as the operating system makes adjustments to synchronize (e.g., with |
10 // NTP servers). Thus, client code that uses the Time class must account for | 10 // NTP servers). Thus, client code that uses the Time class must account for |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 // On Mac & Linux, this value is the delta from the Windows epoch of 1601 to | 414 // On Mac & Linux, this value is the delta from the Windows epoch of 1601 to |
415 // the Posix delta of 1970. This is used for migrating between the old | 415 // the Posix delta of 1970. This is used for migrating between the old |
416 // 1970-based epochs to the new 1601-based ones. It should be removed from | 416 // 1970-based epochs to the new 1601-based ones. It should be removed from |
417 // this global header and put in the platform-specific ones when we remove the | 417 // this global header and put in the platform-specific ones when we remove the |
418 // migration code. | 418 // migration code. |
419 static const int64 kWindowsEpochDeltaMicroseconds; | 419 static const int64 kWindowsEpochDeltaMicroseconds; |
420 #else | 420 #else |
421 // To avoid overflow in QPC to Microseconds calculations, since we multiply | 421 // To avoid overflow in QPC to Microseconds calculations, since we multiply |
422 // by kMicrosecondsPerSecond, then the QPC value should not exceed | 422 // by kMicrosecondsPerSecond, then the QPC value should not exceed |
423 // (2^63 - 1) / 1E6. If it exceeds that threshold, we divide then multiply. | 423 // (2^63 - 1) / 1E6. If it exceeds that threshold, we divide then multiply. |
424 static const int64 kQPCOverflowThreshold = 0x8637BD05AF7; | 424 enum : int64 { kQPCOverflowThreshold = 0x8637BD05AF7 }; |
425 #endif | 425 #endif |
426 | 426 |
427 // Represents an exploded time that can be formatted nicely. This is kind of | 427 // Represents an exploded time that can be formatted nicely. This is kind of |
428 // like the Win32 SYSTEMTIME structure or the Unix "struct tm" with a few | 428 // like the Win32 SYSTEMTIME structure or the Unix "struct tm" with a few |
429 // additions and changes to prevent errors. | 429 // additions and changes to prevent errors. |
430 struct BASE_EXPORT Exploded { | 430 struct BASE_EXPORT Exploded { |
431 int year; // Four digit year "2007" | 431 int year; // Four digit year "2007" |
432 int month; // 1-based month (values 1 = January, etc.) | 432 int month; // 1-based month (values 1 = January, etc.) |
433 int day_of_week; // 0-based day of week (0 = Sunday, etc.) | 433 int day_of_week; // 0-based day of week (0 = Sunday, etc.) |
434 int day_of_month; // 1-based day of month (1-31) | 434 int day_of_month; // 1-based day of month (1-31) |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 explicit TraceTicks(int64 us) : TimeBase(us) { | 826 explicit TraceTicks(int64 us) : TimeBase(us) { |
827 } | 827 } |
828 }; | 828 }; |
829 | 829 |
830 // For logging use only. | 830 // For logging use only. |
831 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TraceTicks time_ticks); | 831 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TraceTicks time_ticks); |
832 | 832 |
833 } // namespace base | 833 } // namespace base |
834 | 834 |
835 #endif // BASE_TIME_TIME_H_ | 835 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |