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 #include "src/base/platform/time.h" | 5 #include "src/base/platform/time.h" |
6 | 6 |
7 #if V8_OS_POSIX | 7 #if V8_OS_POSIX |
8 #include <fcntl.h> // for O_RDONLY | 8 #include <fcntl.h> // for O_RDONLY |
9 #include <sys/time.h> | 9 #include <sys/time.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 DCHECK_LT(ts.tv_nsec, | 104 DCHECK_LT(ts.tv_nsec, |
105 static_cast<long>(Time::kNanosecondsPerSecond)); // NOLINT | 105 static_cast<long>(Time::kNanosecondsPerSecond)); // NOLINT |
106 return TimeDelta(ts.tv_sec * Time::kMicrosecondsPerSecond + | 106 return TimeDelta(ts.tv_sec * Time::kMicrosecondsPerSecond + |
107 ts.tv_nsec / Time::kNanosecondsPerMicrosecond); | 107 ts.tv_nsec / Time::kNanosecondsPerMicrosecond); |
108 } | 108 } |
109 | 109 |
110 | 110 |
111 struct mach_timespec TimeDelta::ToMachTimespec() const { | 111 struct mach_timespec TimeDelta::ToMachTimespec() const { |
112 struct mach_timespec ts; | 112 struct mach_timespec ts; |
113 DCHECK(delta_ >= 0); | 113 DCHECK(delta_ >= 0); |
114 ts.tv_sec = delta_ / Time::kMicrosecondsPerSecond; | 114 ts.tv_sec = static_cast<unsigned>(delta_ / Time::kMicrosecondsPerSecond); |
115 ts.tv_nsec = (delta_ % Time::kMicrosecondsPerSecond) * | 115 ts.tv_nsec = (delta_ % Time::kMicrosecondsPerSecond) * |
116 Time::kNanosecondsPerMicrosecond; | 116 Time::kNanosecondsPerMicrosecond; |
117 return ts; | 117 return ts; |
118 } | 118 } |
119 | 119 |
120 #endif // V8_OS_MACOSX | 120 #endif // V8_OS_MACOSX |
121 | 121 |
122 | 122 |
123 #if V8_OS_POSIX | 123 #if V8_OS_POSIX |
124 | 124 |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 | 638 |
639 | 639 |
640 // static | 640 // static |
641 bool TimeTicks::KernelTimestampAvailable() { | 641 bool TimeTicks::KernelTimestampAvailable() { |
642 return kernel_tick_clock.Pointer()->Available(); | 642 return kernel_tick_clock.Pointer()->Available(); |
643 } | 643 } |
644 | 644 |
645 #endif // V8_OS_WIN | 645 #endif // V8_OS_WIN |
646 | 646 |
647 } } // namespace v8::base | 647 } } // namespace v8::base |
OLD | NEW |