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