| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 return true; | 319 return true; |
| 320 } | 320 } |
| 321 | 321 |
| 322 *time = Time(0); | 322 *time = Time(0); |
| 323 return false; | 323 return false; |
| 324 } | 324 } |
| 325 | 325 |
| 326 // TimeTicks ------------------------------------------------------------------ | 326 // TimeTicks ------------------------------------------------------------------ |
| 327 // static | 327 // static |
| 328 TimeTicks TimeTicks::Now() { | 328 TimeTicks TimeTicks::Now() { |
| 329 return TimeTicks(ClockNow(CLOCK_MONOTONIC)); | 329 return TimeTicks(ClockNow(CLOCK_MONOTONIC_RAW)); |
| 330 } | 330 } |
| 331 | 331 |
| 332 // static | 332 // static |
| 333 TimeTicks::Clock TimeTicks::GetClock() { | 333 TimeTicks::Clock TimeTicks::GetClock() { |
| 334 return Clock::LINUX_CLOCK_MONOTONIC; | 334 return Clock::LINUX_CLOCK_MONOTONIC; |
| 335 } | 335 } |
| 336 | 336 |
| 337 // static | 337 // static |
| 338 bool TimeTicks::IsHighResolution() { | 338 bool TimeTicks::IsHighResolution() { |
| 339 return true; | 339 return true; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; | 377 result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; |
| 378 return result; | 378 return result; |
| 379 } | 379 } |
| 380 int64_t us = us_ - kTimeTToMicrosecondsOffset; | 380 int64_t us = us_ - kTimeTToMicrosecondsOffset; |
| 381 result.tv_sec = us / Time::kMicrosecondsPerSecond; | 381 result.tv_sec = us / Time::kMicrosecondsPerSecond; |
| 382 result.tv_usec = us % Time::kMicrosecondsPerSecond; | 382 result.tv_usec = us % Time::kMicrosecondsPerSecond; |
| 383 return result; | 383 return result; |
| 384 } | 384 } |
| 385 | 385 |
| 386 } // namespace base | 386 } // namespace base |
| OLD | NEW |