Chromium Code Reviews| 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 |
| 25 // instance. Thus, they can be efficiently passed by-value (as opposed to | 25 // instance. Thus, they can be efficiently passed by-value (as opposed to |
| 26 // by-reference). | 26 // by-reference). |
| 27 // | 27 // |
| 28 // Prefer passing these classes by value: | |
|
danakj
2016/09/30 20:18:56
can you combine these two comments then cuz saying
robliao
2016/09/30 20:26:29
Done!
// All time classes are copyable, assignabl
| |
| 29 // void MyFunction(TimeDelta arg); | |
| 30 // If circumstances require, you may also pass by const reference: | |
| 31 // void MyFunction(const TimeDelta& arg); // Not preferred. | |
| 32 // | |
| 28 // Definitions of operator<< are provided to make these types work with | 33 // Definitions of operator<< are provided to make these types work with |
| 29 // DCHECK_EQ() and other log macros. For human-readable formatting, see | 34 // DCHECK_EQ() and other log macros. For human-readable formatting, see |
| 30 // "base/i18n/time_formatting.h". | 35 // "base/i18n/time_formatting.h". |
| 31 // | 36 // |
| 32 // So many choices! Which time class should you use? Examples: | 37 // So many choices! Which time class should you use? Examples: |
| 33 // | 38 // |
| 34 // Time: Interpreting the wall-clock time provided by a remote | 39 // Time: Interpreting the wall-clock time provided by a remote |
| 35 // system. Detecting whether cached resources have | 40 // system. Detecting whether cached resources have |
| 36 // expired. Providing the user with a display of the current date | 41 // expired. Providing the user with a display of the current date |
| 37 // and time. Determining the amount of time between events across | 42 // and time. Determining the amount of time between events across |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 833 static void WaitUntilInitializedWin(); | 838 static void WaitUntilInitializedWin(); |
| 834 #endif | 839 #endif |
| 835 }; | 840 }; |
| 836 | 841 |
| 837 // For logging use only. | 842 // For logging use only. |
| 838 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); | 843 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); |
| 839 | 844 |
| 840 } // namespace base | 845 } // namespace base |
| 841 | 846 |
| 842 #endif // BASE_TIME_TIME_H_ | 847 #endif // BASE_TIME_TIME_H_ |
| OLD | NEW |