Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: base/time/time_posix.cc

Issue 2172483002: Use CLOCK_MONOTONIC_RAW for TimeTicks on Posix systems. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698