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; |
237 static const int64 kMicrosecondsPerMillisecond = 1000; | 238 static const int64 kMicrosecondsPerMillisecond = 1000; |
238 static const int64 kMicrosecondsPerSecond = kMicrosecondsPerMillisecond * | 239 static const int64 kMicrosecondsPerSecond = kMicrosecondsPerMillisecond * |
239 kMillisecondsPerSecond; | 240 kMillisecondsPerSecond; |
240 static const int64 kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60; | 241 static const int64 kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60; |
241 static const int64 kMicrosecondsPerHour = kMicrosecondsPerMinute * 60; | 242 static const int64 kMicrosecondsPerHour = kMicrosecondsPerMinute * 60; |
242 static const int64 kMicrosecondsPerDay = kMicrosecondsPerHour * 24; | 243 static const int64 kMicrosecondsPerDay = kMicrosecondsPerHour * 24; |
Lei Zhang
2015/03/16 21:11:49
Since you are adding |kHoursPerDay|, can you use t
qiankun
2015/03/17 03:20:35
Done.
| |
243 static const int64 kMicrosecondsPerWeek = kMicrosecondsPerDay * 7; | 244 static const int64 kMicrosecondsPerWeek = kMicrosecondsPerDay * 7; |
245 static const int64 kMillisecondsPerDay = kMicrosecondsPerDay / 1000; | |
Lei Zhang
2015/03/16 21:11:49
Can you put this in order - just under |kMilliseco
qiankun
2015/03/17 03:20:35
Done.
| |
244 static const int64 kNanosecondsPerMicrosecond = 1000; | 246 static const int64 kNanosecondsPerMicrosecond = 1000; |
245 static const int64 kNanosecondsPerSecond = kNanosecondsPerMicrosecond * | 247 static const int64 kNanosecondsPerSecond = kNanosecondsPerMicrosecond * |
246 kMicrosecondsPerSecond; | 248 kMicrosecondsPerSecond; |
247 | 249 |
248 // The representation of Jan 1, 1970 UTC in microseconds since the | 250 // The representation of Jan 1, 1970 UTC in microseconds since the |
249 // platform-dependent epoch. | 251 // platform-dependent epoch. |
250 static const int64 kTimeTToMicrosecondsOffset; | 252 static const int64 kTimeTToMicrosecondsOffset; |
251 | 253 |
252 #if !defined(OS_WIN) | 254 #if !defined(OS_WIN) |
253 // On Mac & Linux, this value is the delta from the Windows epoch of 1601 to | 255 // On Mac & Linux, this value is the delta from the Windows epoch of 1601 to |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
758 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 760 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
759 return TimeTicks(t.ticks_ + delta_); | 761 return TimeTicks(t.ticks_ + delta_); |
760 } | 762 } |
761 | 763 |
762 // For logging use only. | 764 // For logging use only. |
763 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TimeTicks time_ticks); | 765 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TimeTicks time_ticks); |
764 | 766 |
765 } // namespace base | 767 } // namespace base |
766 | 768 |
767 #endif // BASE_TIME_TIME_H_ | 769 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |