| 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 coordinated universal time (UTC), |
| 6 // microseconds (s/1,000,000) since the Windows epoch (1601-01-01 00:00:00 UTC) | 6 // internally represented as microseconds (s/1,000,000) since the Windows epoch |
| 7 // (See http://crbug.com/14734). System-dependent clock interface routines are | 7 // (1601-01-01 00:00:00 UTC) (See http://crbug.com/14734). System-dependent |
| 8 // 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 |
| 11 // microseconds. | 11 // microseconds. |
| 12 // | 12 // |
| 13 // TimeTicks represents an abstract time that is most of the time incrementing | 13 // TimeTicks represents an abstract time that is most of the time incrementing |
| 14 // for use in measuring time durations. It is internally represented in | 14 // for use in measuring time durations. It is internally represented in |
| 15 // microseconds. It can not be converted to a human-readable time, but is | 15 // microseconds. It can not be converted to a human-readable time, but is |
| 16 // guaranteed not to decrease (if the user changes the computer clock, | 16 // guaranteed not to decrease (if the user changes the computer clock, |
| 17 // Time::Now() may actually decrease or jump). But note that TimeTicks may | 17 // Time::Now() may actually decrease or jump). But note that TimeTicks may |
| 18 // "stand still", for example if the computer suspended. | 18 // "stand still", for example if the computer suspended. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // Delta in microseconds. | 201 // Delta in microseconds. |
| 202 int64 delta_; | 202 int64 delta_; |
| 203 }; | 203 }; |
| 204 | 204 |
| 205 inline TimeDelta operator*(int64 a, TimeDelta td) { | 205 inline TimeDelta operator*(int64 a, TimeDelta td) { |
| 206 return TimeDelta(a * td.delta_); | 206 return TimeDelta(a * td.delta_); |
| 207 } | 207 } |
| 208 | 208 |
| 209 // Time ----------------------------------------------------------------------- | 209 // Time ----------------------------------------------------------------------- |
| 210 | 210 |
| 211 // Represents a wall clock time. | 211 // Represents a wall clock time in UTC. |
| 212 class BASE_EXPORT Time { | 212 class BASE_EXPORT Time { |
| 213 public: | 213 public: |
| 214 static const int64 kMillisecondsPerSecond = 1000; | 214 static const int64 kMillisecondsPerSecond = 1000; |
| 215 static const int64 kMicrosecondsPerMillisecond = 1000; | 215 static const int64 kMicrosecondsPerMillisecond = 1000; |
| 216 static const int64 kMicrosecondsPerSecond = kMicrosecondsPerMillisecond * | 216 static const int64 kMicrosecondsPerSecond = kMicrosecondsPerMillisecond * |
| 217 kMillisecondsPerSecond; | 217 kMillisecondsPerSecond; |
| 218 static const int64 kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60; | 218 static const int64 kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60; |
| 219 static const int64 kMicrosecondsPerHour = kMicrosecondsPerMinute * 60; | 219 static const int64 kMicrosecondsPerHour = kMicrosecondsPerMinute * 60; |
| 220 static const int64 kMicrosecondsPerDay = kMicrosecondsPerHour * 24; | 220 static const int64 kMicrosecondsPerDay = kMicrosecondsPerHour * 24; |
| 221 static const int64 kMicrosecondsPerWeek = kMicrosecondsPerDay * 7; | 221 static const int64 kMicrosecondsPerWeek = kMicrosecondsPerDay * 7; |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 #endif | 730 #endif |
| 731 }; | 731 }; |
| 732 | 732 |
| 733 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 733 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
| 734 return TimeTicks(t.ticks_ + delta_); | 734 return TimeTicks(t.ticks_ + delta_); |
| 735 } | 735 } |
| 736 | 736 |
| 737 } // namespace base | 737 } // namespace base |
| 738 | 738 |
| 739 #endif // BASE_TIME_TIME_H_ | 739 #endif // BASE_TIME_TIME_H_ |
| OLD | NEW |