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 #include "base/time/time.h" | 5 #include "base/time/time.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <sys/time.h> | 8 #include <sys/time.h> |
9 #include <time.h> | 9 #include <time.h> |
10 #if defined(OS_ANDROID) | 10 #if defined(OS_ANDROID) |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 TimeTicks TimeTicks::Now() { | 261 TimeTicks TimeTicks::Now() { |
262 return ClockNow(CLOCK_MONOTONIC); | 262 return ClockNow(CLOCK_MONOTONIC); |
263 } | 263 } |
264 | 264 |
265 // static | 265 // static |
266 TimeTicks TimeTicks::HighResNow() { | 266 TimeTicks TimeTicks::HighResNow() { |
267 return Now(); | 267 return Now(); |
268 } | 268 } |
269 | 269 |
270 // static | 270 // static |
| 271 bool TimeTicks::IsHighResNowFastAndReliable() { |
| 272 return true; |
| 273 } |
| 274 |
| 275 // static |
271 TimeTicks TimeTicks::ThreadNow() { | 276 TimeTicks TimeTicks::ThreadNow() { |
272 #if defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0) | 277 #if defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0) |
273 return ClockNow(CLOCK_THREAD_CPUTIME_ID); | 278 return ClockNow(CLOCK_THREAD_CPUTIME_ID); |
274 #else | 279 #else |
275 NOTREACHED(); | 280 NOTREACHED(); |
276 return TimeTicks(); | 281 return TimeTicks(); |
277 #endif | 282 #endif |
278 } | 283 } |
279 | 284 |
280 #if defined(OS_CHROMEOS) | 285 #if defined(OS_CHROMEOS) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; | 343 result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; |
339 return result; | 344 return result; |
340 } | 345 } |
341 int64 us = us_ - kTimeTToMicrosecondsOffset; | 346 int64 us = us_ - kTimeTToMicrosecondsOffset; |
342 result.tv_sec = us / Time::kMicrosecondsPerSecond; | 347 result.tv_sec = us / Time::kMicrosecondsPerSecond; |
343 result.tv_usec = us % Time::kMicrosecondsPerSecond; | 348 result.tv_usec = us % Time::kMicrosecondsPerSecond; |
344 return result; | 349 return result; |
345 } | 350 } |
346 | 351 |
347 } // namespace base | 352 } // namespace base |
OLD | NEW |