import android.os.SystemClock;
三种获取系统时间函数的差别
SystemClock.currentThreadTimeMillis();
SystemClock.elapsedRealtime();
SystemClock.uptimeMillis();
/**
* Returns milliseconds since boot, not counting time spent in deep sleep.
* <b>Note:</b> This value may get reset occasionally (before it would
* otherwise wrap around).
*
* @return milliseconds of non-sleep uptime since boot.
*/
native public static long uptimeMillis();
/**
* Returns milliseconds since boot, including time spent in sleep.
*
* @return elapsed milliseconds since boot.
*/
native public static long elapsedRealtime();
/**
* Returns milliseconds running in the current thread.
*
* @return elapsed milliseconds in the thread
*/
public static native long currentThreadTimeMillis();
三种获取系统时间函数的差别
最新推荐文章于 2023-08-07 16:54:10 发布