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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 #if defined(OS_WIN) | 616 #if defined(OS_WIN) |
617 // Get the absolute value of QPC time drift. For testing. | 617 // Get the absolute value of QPC time drift. For testing. |
618 static int64 GetQPCDriftMicroseconds(); | 618 static int64 GetQPCDriftMicroseconds(); |
619 | 619 |
620 static TimeTicks FromQPCValue(LONGLONG qpc_value); | 620 static TimeTicks FromQPCValue(LONGLONG qpc_value); |
621 | 621 |
622 // Returns true if the high resolution clock is working on this system. | 622 // Returns true if the high resolution clock is working on this system. |
623 // This is only for testing. | 623 // This is only for testing. |
624 static bool IsHighResClockWorking(); | 624 static bool IsHighResClockWorking(); |
625 | 625 |
626 // Enable high resolution time for TimeTicks::Now(). This function will | |
627 // test for the availability of a working implementation of | |
628 // QueryPerformanceCounter(). If one is not available, this function does | |
629 // nothing and the resolution of Now() remains 1ms. Otherwise, all future | |
630 // calls to TimeTicks::Now() will have the higher resolution provided by QPC. | |
631 // Returns true if high resolution time was successfully enabled. | |
632 static bool SetNowIsHighResNowIfSupported(); | |
633 | |
634 // Returns a time value that is NOT rollover protected. | 626 // Returns a time value that is NOT rollover protected. |
635 static TimeTicks UnprotectedNow(); | 627 static TimeTicks UnprotectedNow(); |
636 #endif | 628 #endif |
637 | 629 |
638 // Returns true if this object has not been initialized. | 630 // Returns true if this object has not been initialized. |
639 bool is_null() const { | 631 bool is_null() const { |
640 return ticks_ == 0; | 632 return ticks_ == 0; |
641 } | 633 } |
642 | 634 |
643 // Converts an integer value representing TimeTicks to a class. This is used | 635 // 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... |
727 #endif | 719 #endif |
728 }; | 720 }; |
729 | 721 |
730 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 722 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
731 return TimeTicks(t.ticks_ + delta_); | 723 return TimeTicks(t.ticks_ + delta_); |
732 } | 724 } |
733 | 725 |
734 } // namespace base | 726 } // namespace base |
735 | 727 |
736 #endif // BASE_TIME_TIME_H_ | 728 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |