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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 // The resolution of this clock is ~1-15ms. Resolution varies depending | 537 // The resolution of this clock is ~1-15ms. Resolution varies depending |
538 // on hardware/operating system configuration. | 538 // on hardware/operating system configuration. |
539 static TimeTicks Now(); | 539 static TimeTicks Now(); |
540 | 540 |
541 // Returns a platform-dependent high-resolution tick count. Implementation | 541 // Returns a platform-dependent high-resolution tick count. Implementation |
542 // is hardware dependent and may or may not return sub-millisecond | 542 // is hardware dependent and may or may not return sub-millisecond |
543 // resolution. THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND | 543 // resolution. THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND |
544 // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED. | 544 // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED. |
545 static TimeTicks HighResNow(); | 545 static TimeTicks HighResNow(); |
546 | 546 |
| 547 static bool IsHighResNowFastAndReliable(); |
| 548 |
547 // Returns true if ThreadNow() is supported on this system. | 549 // Returns true if ThreadNow() is supported on this system. |
548 static bool IsThreadNowSupported() { | 550 static bool IsThreadNowSupported() { |
549 #if defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0) | 551 #if defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0) |
550 return true; | 552 return true; |
551 #else | 553 #else |
552 return false; | 554 return false; |
553 #endif | 555 #endif |
554 } | 556 } |
555 | 557 |
556 // Returns thread-specific CPU-time on systems that support this feature. | 558 // Returns thread-specific CPU-time on systems that support this feature. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 #endif | 675 #endif |
674 }; | 676 }; |
675 | 677 |
676 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 678 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
677 return TimeTicks(t.ticks_ + delta_); | 679 return TimeTicks(t.ticks_ + delta_); |
678 } | 680 } |
679 | 681 |
680 } // namespace base | 682 } // namespace base |
681 | 683 |
682 #endif // BASE_TIME_TIME_H_ | 684 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |