diff --git a/core/jni/android_os_SystemClock.cpp b/core/jni/android_os_SystemClock.cpp index 1f000d748b1fa..b1f600053b9bc 100644 --- a/core/jni/android_os_SystemClock.cpp +++ b/core/jni/android_os_SystemClock.cpp @@ -29,10 +29,8 @@ #include "jni.h" #include "core_jni_helpers.h" -#include -#include - #include +#include namespace android { @@ -49,11 +47,7 @@ static_assert(std::is_same::value, */ static jlong android_os_SystemClock_currentThreadTimeMillis() { - struct timespec tm; - - clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tm); - - return tm.tv_sec * 1000LL + tm.tv_nsec / 1000000; + return nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_THREAD)); } /* @@ -61,11 +55,7 @@ static jlong android_os_SystemClock_currentThreadTimeMillis() */ static jlong android_os_SystemClock_currentThreadTimeMicro() { - struct timespec tm; - - clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tm); - - return tm.tv_sec * 1000000LL + tm.tv_nsec / 1000; + return nanoseconds_to_microseconds(systemTime(SYSTEM_TIME_THREAD)); } /*