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

Unified Diff: runtime/platform/thread_android.cc

Issue 254383003: Small fixes for Android. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: runtime/platform/thread_android.cc
===================================================================
--- runtime/platform/thread_android.cc (revision 35316)
+++ runtime/platform/thread_android.cc (working copy)
@@ -40,13 +40,13 @@
static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) {
+ struct timeval tv;
int64_t secs = micros / kMicrosecondsPerSecond;
- int64_t nanos =
- (micros - (secs * kMicrosecondsPerSecond)) * kNanosecondsPerMicrosecond;
- int result = clock_gettime(CLOCK_MONOTONIC, ts);
+ int64_t remaining_micros = (micros - (secs * kMicrosecondsPerSecond));
+ int result = gettimeofday(&tv, NULL);
ASSERT(result == 0);
- ts->tv_sec += secs;
- ts->tv_nsec += nanos;
+ ts->tv_sec = tv.tv_sec + secs;
+ ts->tv_nsec = (tv.tv_usec + remaining_micros) * kNanosecondsPerMicrosecond;
if (ts->tv_nsec >= kNanosecondsPerSecond) {
ts->tv_sec += 1;
ts->tv_nsec -= kNanosecondsPerSecond;
@@ -145,7 +145,7 @@
ThreadId Thread::GetCurrentThreadId() {
- return pthread_self();
+ return gettid();
}
@@ -156,7 +156,7 @@
bool Thread::Compare(ThreadId a, ThreadId b) {
- return pthread_equal(a, b) != 0;
+ return a == b;
}

Powered by Google App Engine
This is Rietveld 408576698