OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 70 matching lines...) Loading... |
81 double InMillisecondsF() const; | 81 double InMillisecondsF() const; |
82 int64_t InMilliseconds() const; | 82 int64_t InMilliseconds() const; |
83 int64_t InMillisecondsRoundedUp() const; | 83 int64_t InMillisecondsRoundedUp() const; |
84 int64_t InMicroseconds() const { return delta_; } | 84 int64_t InMicroseconds() const { return delta_; } |
85 int64_t InNanoseconds() const; | 85 int64_t InNanoseconds() const; |
86 | 86 |
87 // Converts to/from Mach time specs. | 87 // Converts to/from Mach time specs. |
88 static TimeDelta FromMachTimespec(struct mach_timespec ts); | 88 static TimeDelta FromMachTimespec(struct mach_timespec ts); |
89 struct mach_timespec ToMachTimespec() const; | 89 struct mach_timespec ToMachTimespec() const; |
90 | 90 |
| 91 // Converts to/from POSIX time specs. |
| 92 static TimeDelta FromTimespec(struct timespec ts); |
| 93 struct timespec ToTimespec() const; |
| 94 |
91 TimeDelta& operator=(const TimeDelta& other) { | 95 TimeDelta& operator=(const TimeDelta& other) { |
92 delta_ = other.delta_; | 96 delta_ = other.delta_; |
93 return *this; | 97 return *this; |
94 } | 98 } |
95 | 99 |
96 // Computations with other deltas. | 100 // Computations with other deltas. |
97 TimeDelta operator+(const TimeDelta& other) const { | 101 TimeDelta operator+(const TimeDelta& other) const { |
98 return TimeDelta(delta_ + other.delta_); | 102 return TimeDelta(delta_ + other.delta_); |
99 } | 103 } |
100 TimeDelta operator-(const TimeDelta& other) const { | 104 TimeDelta operator-(const TimeDelta& other) const { |
(...skipping 281 matching lines...) Loading... |
382 int64_t ticks_; | 386 int64_t ticks_; |
383 }; | 387 }; |
384 | 388 |
385 inline TimeTicks operator+(const TimeDelta& delta, const TimeTicks& ticks) { | 389 inline TimeTicks operator+(const TimeDelta& delta, const TimeTicks& ticks) { |
386 return ticks + delta; | 390 return ticks + delta; |
387 } | 391 } |
388 | 392 |
389 } } // namespace v8::internal | 393 } } // namespace v8::internal |
390 | 394 |
391 #endif // V8_PLATFORM_TIME_H_ | 395 #endif // V8_PLATFORM_TIME_H_ |
OLD | NEW |