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 |
11 // this. | 11 // this. |
12 // | 12 // |
13 // TimeDelta represents a duration of time, internally represented in | 13 // TimeDelta represents a duration of time, internally represented in |
14 // microseconds. | 14 // microseconds. |
15 // | 15 // |
16 // TimeTicks and ThreadTicks represent an abstract time that is most of the time | 16 // TimeTicks and ThreadTicks represent an abstract time that is most of the time |
17 // incrementing, for use in measuring time durations. Internally, they are | 17 // incrementing, for use in measuring time durations. Internally, they are |
18 // represented in microseconds. They can not be converted to a human-readable | 18 // represented in microseconds. They can not be converted to a human-readable |
19 // time, but are guaranteed not to decrease (unlike the Time class). Note that | 19 // time, but are guaranteed not to decrease (unlike the Time class). Note that |
20 // TimeTicks may "stand still" (e.g., if the computer is suspended), and | 20 // TimeTicks may "stand still" (e.g., if the computer is suspended), and |
21 // ThreadTicks will "stand still" whenever the thread has been de-scheduled by | 21 // ThreadTicks will "stand still" whenever the thread has been de-scheduled by |
22 // the operating system. | 22 // the operating system. |
23 // | 23 // |
24 // All time classes are copyable, assignable, and occupy 64-bits per | 24 // All time classes are copyable, assignable, and occupy 64-bits per instance. |
25 // instance. Thus, they can be efficiently passed by-value (as opposed to | 25 // As a result, prefer passing them by value: |
26 // by-reference). | 26 // void MyFunction(TimeDelta arg); |
| 27 // If circumstances require, you may also pass by const reference: |
| 28 // void MyFunction(const TimeDelta& arg); // Not preferred. |
27 // | 29 // |
28 // Definitions of operator<< are provided to make these types work with | 30 // Definitions of operator<< are provided to make these types work with |
29 // DCHECK_EQ() and other log macros. For human-readable formatting, see | 31 // DCHECK_EQ() and other log macros. For human-readable formatting, see |
30 // "base/i18n/time_formatting.h". | 32 // "base/i18n/time_formatting.h". |
31 // | 33 // |
32 // So many choices! Which time class should you use? Examples: | 34 // So many choices! Which time class should you use? Examples: |
33 // | 35 // |
34 // Time: Interpreting the wall-clock time provided by a remote | 36 // Time: Interpreting the wall-clock time provided by a remote |
35 // system. Detecting whether cached resources have | 37 // system. Detecting whether cached resources have |
36 // expired. Providing the user with a display of the current date | 38 // expired. Providing the user with a display of the current date |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 static void WaitUntilInitializedWin(); | 835 static void WaitUntilInitializedWin(); |
834 #endif | 836 #endif |
835 }; | 837 }; |
836 | 838 |
837 // For logging use only. | 839 // For logging use only. |
838 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); | 840 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); |
839 | 841 |
840 } // namespace base | 842 } // namespace base |
841 | 843 |
842 #endif // BASE_TIME_TIME_H_ | 844 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |