| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project 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 #ifndef V8_BASE_PLATFORM_TIME_H_ | 5 #ifndef V8_BASE_PLATFORM_TIME_H_ |
| 6 #define V8_BASE_PLATFORM_TIME_H_ | 6 #define V8_BASE_PLATFORM_TIME_H_ |
| 7 | 7 |
| 8 #include <time.h> | 8 #include <ctime> |
| 9 #include <iosfwd> |
| 9 #include <limits> | 10 #include <limits> |
| 10 | 11 |
| 11 #include "src/base/macros.h" | 12 #include "src/base/macros.h" |
| 12 | 13 |
| 13 // Forward declarations. | 14 // Forward declarations. |
| 14 extern "C" { | 15 extern "C" { |
| 15 struct _FILETIME; | 16 struct _FILETIME; |
| 16 struct mach_timespec; | 17 struct mach_timespec; |
| 17 struct timespec; | 18 struct timespec; |
| 18 struct timeval; | 19 struct timeval; |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 return us_ >= other.us_; | 274 return us_ >= other.us_; |
| 274 } | 275 } |
| 275 | 276 |
| 276 private: | 277 private: |
| 277 explicit Time(int64_t us) : us_(us) {} | 278 explicit Time(int64_t us) : us_(us) {} |
| 278 | 279 |
| 279 // Time in microseconds in UTC. | 280 // Time in microseconds in UTC. |
| 280 int64_t us_; | 281 int64_t us_; |
| 281 }; | 282 }; |
| 282 | 283 |
| 284 std::ostream& operator<<(std::ostream&, const Time&); |
| 285 |
| 283 inline Time operator+(const TimeDelta& delta, const Time& time) { | 286 inline Time operator+(const TimeDelta& delta, const Time& time) { |
| 284 return time + delta; | 287 return time + delta; |
| 285 } | 288 } |
| 286 | 289 |
| 287 | 290 |
| 288 // ----------------------------------------------------------------------------- | 291 // ----------------------------------------------------------------------------- |
| 289 // TimeTicks | 292 // TimeTicks |
| 290 // | 293 // |
| 291 // This class represents an abstract time that is most of the time incrementing | 294 // This class represents an abstract time that is most of the time incrementing |
| 292 // for use in measuring time durations. It is internally represented in | 295 // for use in measuring time durations. It is internally represented in |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 int64_t ticks_; | 394 int64_t ticks_; |
| 392 }; | 395 }; |
| 393 | 396 |
| 394 inline TimeTicks operator+(const TimeDelta& delta, const TimeTicks& ticks) { | 397 inline TimeTicks operator+(const TimeDelta& delta, const TimeTicks& ticks) { |
| 395 return ticks + delta; | 398 return ticks + delta; |
| 396 } | 399 } |
| 397 | 400 |
| 398 } } // namespace v8::base | 401 } } // namespace v8::base |
| 399 | 402 |
| 400 #endif // V8_BASE_PLATFORM_TIME_H_ | 403 #endif // V8_BASE_PLATFORM_TIME_H_ |
| OLD | NEW |