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 TimeTicksNow() will have the higher resolution provided by QPC. | |
darin (slow to review)
2013/08/12 18:57:36
nit: TimeTicksNow() -> TimeTicks::Now() ?
James Simonsen
2013/08/12 22:57:06
Done.
| |
581 // Returns true if high resolution time was successfully enabled. | |
582 static bool MaybeEnableHighResNowEverywhere(); | |
darin (slow to review)
2013/08/12 18:57:36
nit: The "Everywhere" suffix could maybe be more p
James Simonsen
2013/08/12 22:57:06
Done.
| |
583 | |
584 // Returns a time value that is NOT rollover protected. | |
585 static TimeTicks UnprotectedNow(); | |
575 #endif | 586 #endif |
576 | 587 |
577 // Returns true if this object has not been initialized. | 588 // Returns true if this object has not been initialized. |
578 bool is_null() const { | 589 bool is_null() const { |
579 return ticks_ == 0; | 590 return ticks_ == 0; |
580 } | 591 } |
581 | 592 |
582 // Converts an integer value representing TimeTicks to a class. This is used | 593 // Converts an integer value representing TimeTicks to a class. This is used |
583 // when deserializing a |TimeTicks| structure, using a value known to be | 594 // when deserializing a |TimeTicks| structure, using a value known to be |
584 // compatible. It is not provided as a constructor because the integer type | 595 // 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... | |
658 #endif | 669 #endif |
659 }; | 670 }; |
660 | 671 |
661 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 672 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
662 return TimeTicks(t.ticks_ + delta_); | 673 return TimeTicks(t.ticks_ + delta_); |
663 } | 674 } |
664 | 675 |
665 } // namespace base | 676 } // namespace base |
666 | 677 |
667 #endif // BASE_TIME_TIME_H_ | 678 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |