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 time, internally represented as | 5 // Time represents an absolute point in time, internally represented as |
6 // microseconds (s/1,000,000) since the Windows epoch (1601-01-01 00:00:00 UTC) | 6 // microseconds (s/1,000,000) since the Windows epoch (1601-01-01 00:00:00 UTC) |
7 // (See http://crbug.com/14734). System-dependent clock interface routines are | 7 // (See http://crbug.com/14734). System-dependent clock interface routines are |
8 // defined in time_PLATFORM.cc. | 8 // 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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 | 565 |
566 #if defined(OS_WIN) | 566 #if defined(OS_WIN) |
567 // Get the absolute value of QPC time drift. For testing. | 567 // Get the absolute value of QPC time drift. For testing. |
568 static int64 GetQPCDriftMicroseconds(); | 568 static int64 GetQPCDriftMicroseconds(); |
569 | 569 |
570 static TimeTicks FromQPCValue(LONGLONG qpc_value); | 570 static TimeTicks FromQPCValue(LONGLONG qpc_value); |
571 | 571 |
572 // Returns true if the high resolution clock is working on this system. | 572 // Returns true if the high resolution clock is working on this system. |
573 // This is only for testing. | 573 // This is only for testing. |
574 static bool IsHighResClockWorking(); | 574 static bool IsHighResClockWorking(); |
575 | |
576 // Enable high resolution time for TimeTicks::Now(). This function will | |
577 // test for the availability of a working implementation of | |
578 // QueryPerformanceCounter(). If one is not available, this function does | |
579 // nothing and the resolution of Now() remains 1ms. Otherwise, all future | |
580 // calls to TimeTicks::Now() will have the higher resolution provided by QPC. | |
581 // Returns true if high resolution time was successfully enabled. | |
582 static bool SetNowIsHighResNowIfSupported(); | |
583 | |
584 // Returns a time value that is NOT rollover protected. | |
585 static TimeTicks UnprotectedNow(); | |
586 #endif | 575 #endif |
587 | 576 |
588 // Returns true if this object has not been initialized. | 577 // Returns true if this object has not been initialized. |
589 bool is_null() const { | 578 bool is_null() const { |
590 return ticks_ == 0; | 579 return ticks_ == 0; |
591 } | 580 } |
592 | 581 |
593 // Converts an integer value representing TimeTicks to a class. This is used | 582 // Converts an integer value representing TimeTicks to a class. This is used |
594 // when deserializing a |TimeTicks| structure, using a value known to be | 583 // when deserializing a |TimeTicks| structure, using a value known to be |
595 // compatible. It is not provided as a constructor because the integer type | 584 // compatible. It is not provided as a constructor because the integer type |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 #endif | 658 #endif |
670 }; | 659 }; |
671 | 660 |
672 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 661 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
673 return TimeTicks(t.ticks_ + delta_); | 662 return TimeTicks(t.ticks_ + delta_); |
674 } | 663 } |
675 | 664 |
676 } // namespace base | 665 } // namespace base |
677 | 666 |
678 #endif // BASE_TIME_TIME_H_ | 667 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |