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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 } | 569 } |
570 | 570 |
571 inline Time TimeDelta::operator+(Time t) const { | 571 inline Time TimeDelta::operator+(Time t) const { |
572 return Time(t.us_ + delta_); | 572 return Time(t.us_ + delta_); |
573 } | 573 } |
574 | 574 |
575 // TimeTicks ------------------------------------------------------------------ | 575 // TimeTicks ------------------------------------------------------------------ |
576 | 576 |
577 class BASE_EXPORT TimeTicks { | 577 class BASE_EXPORT TimeTicks { |
578 public: | 578 public: |
| 579 // We define this even without OS_CHROMEOS for seccomp sandbox testing. |
| 580 #if defined(OS_LINUX) |
| 581 // Force definition of the system trace clock; it is a chromeos-only api |
| 582 // at the moment and surfacing it in the right place requires mucking |
| 583 // with glibc et al. |
| 584 static const clockid_t kClockSystemTrace = 11; |
| 585 #endif |
| 586 |
579 TimeTicks() : ticks_(0) { | 587 TimeTicks() : ticks_(0) { |
580 } | 588 } |
581 | 589 |
582 // Platform-dependent tick count representing "right now." | 590 // Platform-dependent tick count representing "right now." |
583 // The resolution of this clock is ~1-15ms. Resolution varies depending | 591 // The resolution of this clock is ~1-15ms. Resolution varies depending |
584 // on hardware/operating system configuration. | 592 // on hardware/operating system configuration. |
585 static TimeTicks Now(); | 593 static TimeTicks Now(); |
586 | 594 |
587 // Returns a platform-dependent high-resolution tick count. Implementation | 595 // Returns a platform-dependent high-resolution tick count. Implementation |
588 // is hardware dependent and may or may not return sub-millisecond | 596 // is hardware dependent and may or may not return sub-millisecond |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 #endif | 738 #endif |
731 }; | 739 }; |
732 | 740 |
733 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 741 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
734 return TimeTicks(t.ticks_ + delta_); | 742 return TimeTicks(t.ticks_ + delta_); |
735 } | 743 } |
736 | 744 |
737 } // namespace base | 745 } // namespace base |
738 | 746 |
739 #endif // BASE_TIME_TIME_H_ | 747 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |