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

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

Issue 2090783002: Limit InterProcessTimeTicksConverter to platforms that require it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor comment fix 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 | « 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) && !defined(__LP64__) 10 #if defined(OS_ANDROID) && !defined(__LP64__)
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
340 } 340 }
341 341
342 // static 342 // static
343 bool TimeTicks::IsConsistentAcrossProcesses() {
344 return true;
345 }
346
347 // static
343 ThreadTicks ThreadTicks::Now() { 348 ThreadTicks ThreadTicks::Now() {
344 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \ 349 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \
345 defined(OS_ANDROID) 350 defined(OS_ANDROID)
346 return ThreadTicks(ClockNow(CLOCK_THREAD_CPUTIME_ID)); 351 return ThreadTicks(ClockNow(CLOCK_THREAD_CPUTIME_ID));
347 #else 352 #else
348 NOTREACHED(); 353 NOTREACHED();
349 return ThreadTicks(); 354 return ThreadTicks();
350 #endif 355 #endif
351 } 356 }
352 357
(...skipping 24 matching lines...) Expand all
377 result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1; 382 result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1;
378 return result; 383 return result;
379 } 384 }
380 int64_t us = us_ - kTimeTToMicrosecondsOffset; 385 int64_t us = us_ - kTimeTToMicrosecondsOffset;
381 result.tv_sec = us / Time::kMicrosecondsPerSecond; 386 result.tv_sec = us / Time::kMicrosecondsPerSecond;
382 result.tv_usec = us % Time::kMicrosecondsPerSecond; 387 result.tv_usec = us % Time::kMicrosecondsPerSecond;
383 return result; 388 return result;
384 } 389 }
385 390
386 } // namespace base 391 } // 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