读书人

三种获取系统时间函数的区别

发布时间: 2012-07-15 20:20:06 作者: rapoo

三种获取系统时间函数的差别

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();

读书人网 >移动开发

热点推荐