| 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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 | 596 |
| 597 TimeTicks() : ticks_(0) { | 597 TimeTicks() : ticks_(0) { |
| 598 } | 598 } |
| 599 | 599 |
| 600 // Platform-dependent tick count representing "right now." When | 600 // Platform-dependent tick count representing "right now." When |
| 601 // IsHighResolution() returns false, the resolution of the clock could be | 601 // IsHighResolution() returns false, the resolution of the clock could be |
| 602 // as coarse as ~15.6ms. Otherwise, the resolution should be no worse than one | 602 // as coarse as ~15.6ms. Otherwise, the resolution should be no worse than one |
| 603 // microsecond. | 603 // microsecond. |
| 604 static TimeTicks Now(); | 604 static TimeTicks Now(); |
| 605 | 605 |
| 606 // DEPRECATED | |
| 607 // TODO(miu): Remove this function, and all callpoints should call Now(). | |
| 608 static TimeTicks HighResNow() { return TimeTicks::Now(); } | |
| 609 | |
| 610 // Returns true if the high resolution clock is working on this system and | 606 // Returns true if the high resolution clock is working on this system and |
| 611 // Now() will return high resolution values. Note that, on systems where the | 607 // Now() will return high resolution values. Note that, on systems where the |
| 612 // high resolution clock works but is deemed inefficient, the low resolution | 608 // high resolution clock works but is deemed inefficient, the low resolution |
| 613 // clock will be used instead. | 609 // clock will be used instead. |
| 614 static bool IsHighResolution(); | 610 static bool IsHighResolution(); |
| 615 | 611 |
| 616 // DEPRECATED | |
| 617 // TODO(miu): Remove this function, and all callpoints should call | |
| 618 // IsHighResolution(). | |
| 619 static bool IsHighResNowFastAndReliable() { return IsHighResolution(); } | |
| 620 | |
| 621 // Returns true if ThreadNow() is supported on this system. | 612 // Returns true if ThreadNow() is supported on this system. |
| 622 static bool IsThreadNowSupported() { | 613 static bool IsThreadNowSupported() { |
| 623 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \ | 614 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \ |
| 624 (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_ANDROID) | 615 (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_ANDROID) |
| 625 return true; | 616 return true; |
| 626 #else | 617 #else |
| 627 return false; | 618 return false; |
| 628 #endif | 619 #endif |
| 629 } | 620 } |
| 630 | 621 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 748 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
| 758 return TimeTicks(t.ticks_ + delta_); | 749 return TimeTicks(t.ticks_ + delta_); |
| 759 } | 750 } |
| 760 | 751 |
| 761 // For logging use only. | 752 // For logging use only. |
| 762 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TimeTicks time_ticks); | 753 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TimeTicks time_ticks); |
| 763 | 754 |
| 764 } // namespace base | 755 } // namespace base |
| 765 | 756 |
| 766 #endif // BASE_TIME_TIME_H_ | 757 #endif // BASE_TIME_TIME_H_ |
| OLD | NEW |