| 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) && !defined(__LP64__) | 10 #if defined(OS_ANDROID) && !defined(__LP64__) | 
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 307       kWindowsEpochDeltaMicroseconds); | 307       kWindowsEpochDeltaMicroseconds); | 
| 308 } | 308 } | 
| 309 | 309 | 
| 310 // TimeTicks ------------------------------------------------------------------ | 310 // TimeTicks ------------------------------------------------------------------ | 
| 311 // static | 311 // static | 
| 312 TimeTicks TimeTicks::Now() { | 312 TimeTicks TimeTicks::Now() { | 
| 313   return ClockNow(CLOCK_MONOTONIC); | 313   return ClockNow(CLOCK_MONOTONIC); | 
| 314 } | 314 } | 
| 315 | 315 | 
| 316 // static | 316 // static | 
| 317 TimeTicks TimeTicks::HighResNow() { | 317 bool TimeTicks::IsHighResolution() { | 
| 318   return Now(); |  | 
| 319 } |  | 
| 320 |  | 
| 321 // static |  | 
| 322 bool TimeTicks::IsHighResNowFastAndReliable() { |  | 
| 323   return true; | 318   return true; | 
| 324 } | 319 } | 
| 325 | 320 | 
| 326 // static | 321 // static | 
| 327 TimeTicks TimeTicks::ThreadNow() { | 322 TimeTicks TimeTicks::ThreadNow() { | 
| 328 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \ | 323 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \ | 
| 329     defined(OS_ANDROID) | 324     defined(OS_ANDROID) | 
| 330   return ClockNow(CLOCK_THREAD_CPUTIME_ID); | 325   return ClockNow(CLOCK_THREAD_CPUTIME_ID); | 
| 331 #else | 326 #else | 
| 332   NOTREACHED(); | 327   NOTREACHED(); | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 391     result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; | 386     result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; | 
| 392     return result; | 387     return result; | 
| 393   } | 388   } | 
| 394   int64 us = us_ - kTimeTToMicrosecondsOffset; | 389   int64 us = us_ - kTimeTToMicrosecondsOffset; | 
| 395   result.tv_sec = us / Time::kMicrosecondsPerSecond; | 390   result.tv_sec = us / Time::kMicrosecondsPerSecond; | 
| 396   result.tv_usec = us % Time::kMicrosecondsPerSecond; | 391   result.tv_usec = us % Time::kMicrosecondsPerSecond; | 
| 397   return result; | 392   return result; | 
| 398 } | 393 } | 
| 399 | 394 | 
| 400 }  // namespace base | 395 }  // namespace base | 
| OLD | NEW | 
|---|