| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 226 } |
| 227 | 227 |
| 228 // For logging use only. | 228 // For logging use only. |
| 229 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TimeDelta time_delta); | 229 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TimeDelta time_delta); |
| 230 | 230 |
| 231 // Time ----------------------------------------------------------------------- | 231 // Time ----------------------------------------------------------------------- |
| 232 | 232 |
| 233 // Represents a wall clock time in UTC. | 233 // Represents a wall clock time in UTC. |
| 234 class BASE_EXPORT Time { | 234 class BASE_EXPORT Time { |
| 235 public: | 235 public: |
| 236 static const int64 kHoursPerDay = 24; |
| 236 static const int64 kMillisecondsPerSecond = 1000; | 237 static const int64 kMillisecondsPerSecond = 1000; |
| 238 static const int64 kMillisecondsPerDay = kMillisecondsPerSecond * 60 * 60 * |
| 239 kHoursPerDay; |
| 237 static const int64 kMicrosecondsPerMillisecond = 1000; | 240 static const int64 kMicrosecondsPerMillisecond = 1000; |
| 238 static const int64 kMicrosecondsPerSecond = kMicrosecondsPerMillisecond * | 241 static const int64 kMicrosecondsPerSecond = kMicrosecondsPerMillisecond * |
| 239 kMillisecondsPerSecond; | 242 kMillisecondsPerSecond; |
| 240 static const int64 kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60; | 243 static const int64 kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60; |
| 241 static const int64 kMicrosecondsPerHour = kMicrosecondsPerMinute * 60; | 244 static const int64 kMicrosecondsPerHour = kMicrosecondsPerMinute * 60; |
| 242 static const int64 kMicrosecondsPerDay = kMicrosecondsPerHour * 24; | 245 static const int64 kMicrosecondsPerDay = kMicrosecondsPerHour * kHoursPerDay; |
| 243 static const int64 kMicrosecondsPerWeek = kMicrosecondsPerDay * 7; | 246 static const int64 kMicrosecondsPerWeek = kMicrosecondsPerDay * 7; |
| 244 static const int64 kNanosecondsPerMicrosecond = 1000; | 247 static const int64 kNanosecondsPerMicrosecond = 1000; |
| 245 static const int64 kNanosecondsPerSecond = kNanosecondsPerMicrosecond * | 248 static const int64 kNanosecondsPerSecond = kNanosecondsPerMicrosecond * |
| 246 kMicrosecondsPerSecond; | 249 kMicrosecondsPerSecond; |
| 247 | 250 |
| 248 // The representation of Jan 1, 1970 UTC in microseconds since the | 251 // The representation of Jan 1, 1970 UTC in microseconds since the |
| 249 // platform-dependent epoch. | 252 // platform-dependent epoch. |
| 250 static const int64 kTimeTToMicrosecondsOffset; | 253 static const int64 kTimeTToMicrosecondsOffset; |
| 251 | 254 |
| 252 #if !defined(OS_WIN) | 255 #if !defined(OS_WIN) |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 761 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
| 759 return TimeTicks(t.ticks_ + delta_); | 762 return TimeTicks(t.ticks_ + delta_); |
| 760 } | 763 } |
| 761 | 764 |
| 762 // For logging use only. | 765 // For logging use only. |
| 763 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TimeTicks time_ticks); | 766 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TimeTicks time_ticks); |
| 764 | 767 |
| 765 } // namespace base | 768 } // namespace base |
| 766 | 769 |
| 767 #endif // BASE_TIME_TIME_H_ | 770 #endif // BASE_TIME_TIME_H_ |
| OLD | NEW |