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

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

Issue 27317002: base: Add base::TimeTicks::IsHighResNowFastAndReliable (Closed) Base URL: http://git.chromium.org/chromium/src.git@reenableHeavyPage
Patch Set: Fix link errors Created 7 years, 2 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 | « base/time/time_mac.cc ('k') | base/time/time_win.cc » ('j') | 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) 10 #if defined(OS_ANDROID)
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « base/time/time_mac.cc ('k') | base/time/time_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698