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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 // value for the duration of the application, but will be different in future | 673 // value for the duration of the application, but will be different in future |
674 // application runs. | 674 // application runs. |
675 static TimeTicks UnixEpoch(); | 675 static TimeTicks UnixEpoch(); |
676 | 676 |
677 // Returns the internal numeric value of the TimeTicks object. | 677 // Returns the internal numeric value of the TimeTicks object. |
678 // For serializing, use FromInternalValue to reconstitute. | 678 // For serializing, use FromInternalValue to reconstitute. |
679 int64 ToInternalValue() const { | 679 int64 ToInternalValue() const { |
680 return ticks_; | 680 return ticks_; |
681 } | 681 } |
682 | 682 |
| 683 // Returns |this| snapped to the next tick, given a |tick_phase| and |
| 684 // repeating |tick_interval| in both directions. |this| may be before, |
| 685 // after, or equal to the |tick_phase|. |
| 686 TimeTicks SnappedToNextTick(TimeTicks tick_phase, |
| 687 TimeDelta tick_interval) const; |
| 688 |
683 TimeTicks& operator=(TimeTicks other) { | 689 TimeTicks& operator=(TimeTicks other) { |
684 ticks_ = other.ticks_; | 690 ticks_ = other.ticks_; |
685 return *this; | 691 return *this; |
686 } | 692 } |
687 | 693 |
688 // Compute the difference between two times. | 694 // Compute the difference between two times. |
689 TimeDelta operator-(TimeTicks other) const { | 695 TimeDelta operator-(TimeTicks other) const { |
690 return TimeDelta(ticks_ - other.ticks_); | 696 return TimeDelta(ticks_ - other.ticks_); |
691 } | 697 } |
692 | 698 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 754 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
749 return TimeTicks(t.ticks_ + delta_); | 755 return TimeTicks(t.ticks_ + delta_); |
750 } | 756 } |
751 | 757 |
752 // For logging use only. | 758 // For logging use only. |
753 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TimeTicks time_ticks); | 759 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TimeTicks time_ticks); |
754 | 760 |
755 } // namespace base | 761 } // namespace base |
756 | 762 |
757 #endif // BASE_TIME_TIME_H_ | 763 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |