| 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 #if defined(OS_WIN) | 632 #if defined(OS_WIN) |
| 633 // Get the absolute value of QPC time drift. For testing. | 633 // Get the absolute value of QPC time drift. For testing. |
| 634 static int64 GetQPCDriftMicroseconds(); | 634 static int64 GetQPCDriftMicroseconds(); |
| 635 | 635 |
| 636 static TimeTicks FromQPCValue(LONGLONG qpc_value); | 636 static TimeTicks FromQPCValue(LONGLONG qpc_value); |
| 637 | 637 |
| 638 // Returns true if the high resolution clock is working on this system. | 638 // Returns true if the high resolution clock is working on this system. |
| 639 // This is only for testing. | 639 // This is only for testing. |
| 640 static bool IsHighResClockWorking(); | 640 static bool IsHighResClockWorking(); |
| 641 | 641 |
| 642 // Enable high resolution time for TimeTicks::Now(). This function will |
| 643 // test for the availability of a working implementation of |
| 644 // QueryPerformanceCounter(). If one is not available, this function does |
| 645 // nothing and the resolution of Now() remains 1ms. Otherwise, all future |
| 646 // calls to TimeTicks::Now() will have the higher resolution provided by QPC. |
| 647 // Returns true if high resolution time was successfully enabled. |
| 648 static bool SetNowIsHighResNowIfSupported(); |
| 649 |
| 642 // Returns a time value that is NOT rollover protected. | 650 // Returns a time value that is NOT rollover protected. |
| 643 static TimeTicks UnprotectedNow(); | 651 static TimeTicks UnprotectedNow(); |
| 644 #endif | 652 #endif |
| 645 | 653 |
| 646 // Returns true if this object has not been initialized. | 654 // Returns true if this object has not been initialized. |
| 647 bool is_null() const { | 655 bool is_null() const { |
| 648 return ticks_ == 0; | 656 return ticks_ == 0; |
| 649 } | 657 } |
| 650 | 658 |
| 651 // Converts an integer value representing TimeTicks to a class. This is used | 659 // Converts an integer value representing TimeTicks to a class. This is used |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 #endif | 743 #endif |
| 736 }; | 744 }; |
| 737 | 745 |
| 738 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 746 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
| 739 return TimeTicks(t.ticks_ + delta_); | 747 return TimeTicks(t.ticks_ + delta_); |
| 740 } | 748 } |
| 741 | 749 |
| 742 } // namespace base | 750 } // namespace base |
| 743 | 751 |
| 744 #endif // BASE_TIME_TIME_H_ | 752 #endif // BASE_TIME_TIME_H_ |
| OLD | NEW |