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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 return *this; | 171 return *this; |
172 } | 172 } |
173 TimeDelta& operator/=(int64 a) { | 173 TimeDelta& operator/=(int64 a) { |
174 delta_ /= a; | 174 delta_ /= a; |
175 return *this; | 175 return *this; |
176 } | 176 } |
177 int64 operator/(TimeDelta a) const { | 177 int64 operator/(TimeDelta a) const { |
178 return delta_ / a.delta_; | 178 return delta_ / a.delta_; |
179 } | 179 } |
180 | 180 |
181 // Multiplicative computations with floats. | |
182 TimeDelta multiply_by(double a) const { | |
183 return TimeDelta(delta_ * a); | |
184 } | |
185 TimeDelta divide_by(double a) const { | |
186 return TimeDelta(delta_ / a); | |
187 } | |
188 | |
189 // Defined below because it depends on the definition of the other classes. | 181 // Defined below because it depends on the definition of the other classes. |
190 Time operator+(Time t) const; | 182 Time operator+(Time t) const; |
191 TimeTicks operator+(TimeTicks t) const; | 183 TimeTicks operator+(TimeTicks t) const; |
192 | 184 |
193 // Comparison operators. | 185 // Comparison operators. |
194 bool operator==(TimeDelta other) const { | 186 bool operator==(TimeDelta other) const { |
195 return delta_ == other.delta_; | 187 return delta_ == other.delta_; |
196 } | 188 } |
197 bool operator!=(TimeDelta other) const { | 189 bool operator!=(TimeDelta other) const { |
198 return delta_ != other.delta_; | 190 return delta_ != other.delta_; |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 754 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
763 return TimeTicks(t.ticks_ + delta_); | 755 return TimeTicks(t.ticks_ + delta_); |
764 } | 756 } |
765 | 757 |
766 // For logging use only. | 758 // For logging use only. |
767 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TimeTicks time_ticks); | 759 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TimeTicks time_ticks); |
768 | 760 |
769 } // namespace base | 761 } // namespace base |
770 | 762 |
771 #endif // BASE_TIME_TIME_H_ | 763 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |