Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42c56922 authored by Elliott Hughes's avatar Elliott Hughes
Browse files

We have POSIX clocks.

Change-Id: I70f82074f8c14a26c4ed7eb912ddf6d7da44c168
parent fc545733
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -60,18 +60,11 @@ static jlong android_os_SystemClock_elapsedRealtime(JNIEnv* env,
static jlong android_os_SystemClock_currentThreadTimeMillis(JNIEnv* env,
        jobject clazz)
{
#if defined(HAVE_POSIX_CLOCKS)
    struct timespec tm;

    clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tm);

    return tm.tv_sec * 1000LL + tm.tv_nsec / 1000000;
#else
    struct timeval tv;

    gettimeofday(&tv, NULL);
    return tv.tv_sec * 1000LL + tv.tv_usec / 1000;
#endif
}

/*
@@ -80,18 +73,11 @@ static jlong android_os_SystemClock_currentThreadTimeMillis(JNIEnv* env,
static jlong android_os_SystemClock_currentThreadTimeMicro(JNIEnv* env,
        jobject clazz)
{
#if defined(HAVE_POSIX_CLOCKS)
    struct timespec tm;

    clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tm);

    return tm.tv_sec * 1000000LL + tm.tv_nsec / 1000;
#else
    struct timeval tv;

    gettimeofday(&tv, NULL);
    return tv.tv_sec * 1000000LL + tv.tv_nsec / 1000;
#endif
}

/*