Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -16342,6 +16342,7 @@ package android.os { public final class SystemClock { method public static long currentThreadTimeMillis(); method public static long elapsedRealtime(); method public static long elapsedRealtimeNano(); method public static boolean setCurrentTimeMillis(long); method public static void sleep(long); method public static long uptimeMillis(); core/java/android/os/SystemClock.java +17 −9 Original line number Diff line number Diff line Loading @@ -46,15 +46,16 @@ package android.os; * such as {@link Thread#sleep(long) Thread.sleep(millls)}, * {@link Object#wait(long) Object.wait(millis)}, and * {@link System#nanoTime System.nanoTime()}. This clock is guaranteed * to be monotonic, and is the recommended basis for the general purpose * interval timing of user interface events, performance measurements, * and anything else that does not need to measure elapsed time during * device sleep. Most methods that accept a timestamp value expect the * {@link #uptimeMillis} clock. * * <li> <p> {@link #elapsedRealtime} is counted in milliseconds since the * system was booted, including deep sleep. This clock should be used * when measuring time intervals that may span periods of system sleep. * to be monotonic, and is suitable for interval timing when the * interval does not span device sleep. Most methods that accept a * timestamp value currently expect the {@link #uptimeMillis} clock. * * <li> <p> {@link #elapsedRealtime} and {@link #elapsedRealtimeNano} * return the time since the system was booted, and include deep sleep. * This clock is guaranteed to be monotonic, and continues to tick even * when the CPU is in power saving modes, so is the recommend basis * for general purpose interval timing. * * </ul> * * There are several mechanisms for controlling the timing of events: Loading Loading @@ -151,6 +152,13 @@ public final class SystemClock { */ native public static long elapsedRealtime(); /** * Returns nanoseconds since boot, including time spent in sleep. * * @return elapsed nanoseconds since boot. */ public static native long elapsedRealtimeNano(); /** * Returns milliseconds running in the current thread. * Loading core/jni/android_os_SystemClock.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,15 @@ static jlong android_os_SystemClock_currentTimeMicro(JNIEnv* env, return tv.tv_sec * 1000000LL + tv.tv_usec; } /* * public static native long elapsedRealtimeNano(); */ static jlong android_os_SystemClock_elapsedRealtimeNano(JNIEnv* env, jobject clazz) { return (jlong)elapsedRealtimeNano(); } /* * JNI registration. */ Loading @@ -128,6 +137,8 @@ static JNINativeMethod gMethods[] = { (void*) android_os_SystemClock_currentThreadTimeMicro }, { "currentTimeMicro", "()J", (void*) android_os_SystemClock_currentTimeMicro }, { "elapsedRealtimeNano", "()J", (void*) android_os_SystemClock_elapsedRealtimeNano }, }; int register_android_os_SystemClock(JNIEnv* env) { Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -16342,6 +16342,7 @@ package android.os { public final class SystemClock { method public static long currentThreadTimeMillis(); method public static long elapsedRealtime(); method public static long elapsedRealtimeNano(); method public static boolean setCurrentTimeMillis(long); method public static void sleep(long); method public static long uptimeMillis();
core/java/android/os/SystemClock.java +17 −9 Original line number Diff line number Diff line Loading @@ -46,15 +46,16 @@ package android.os; * such as {@link Thread#sleep(long) Thread.sleep(millls)}, * {@link Object#wait(long) Object.wait(millis)}, and * {@link System#nanoTime System.nanoTime()}. This clock is guaranteed * to be monotonic, and is the recommended basis for the general purpose * interval timing of user interface events, performance measurements, * and anything else that does not need to measure elapsed time during * device sleep. Most methods that accept a timestamp value expect the * {@link #uptimeMillis} clock. * * <li> <p> {@link #elapsedRealtime} is counted in milliseconds since the * system was booted, including deep sleep. This clock should be used * when measuring time intervals that may span periods of system sleep. * to be monotonic, and is suitable for interval timing when the * interval does not span device sleep. Most methods that accept a * timestamp value currently expect the {@link #uptimeMillis} clock. * * <li> <p> {@link #elapsedRealtime} and {@link #elapsedRealtimeNano} * return the time since the system was booted, and include deep sleep. * This clock is guaranteed to be monotonic, and continues to tick even * when the CPU is in power saving modes, so is the recommend basis * for general purpose interval timing. * * </ul> * * There are several mechanisms for controlling the timing of events: Loading Loading @@ -151,6 +152,13 @@ public final class SystemClock { */ native public static long elapsedRealtime(); /** * Returns nanoseconds since boot, including time spent in sleep. * * @return elapsed nanoseconds since boot. */ public static native long elapsedRealtimeNano(); /** * Returns milliseconds running in the current thread. * Loading
core/jni/android_os_SystemClock.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,15 @@ static jlong android_os_SystemClock_currentTimeMicro(JNIEnv* env, return tv.tv_sec * 1000000LL + tv.tv_usec; } /* * public static native long elapsedRealtimeNano(); */ static jlong android_os_SystemClock_elapsedRealtimeNano(JNIEnv* env, jobject clazz) { return (jlong)elapsedRealtimeNano(); } /* * JNI registration. */ Loading @@ -128,6 +137,8 @@ static JNINativeMethod gMethods[] = { (void*) android_os_SystemClock_currentThreadTimeMicro }, { "currentTimeMicro", "()J", (void*) android_os_SystemClock_currentTimeMicro }, { "elapsedRealtimeNano", "()J", (void*) android_os_SystemClock_elapsedRealtimeNano }, }; int register_android_os_SystemClock(JNIEnv* env) { Loading