import android.os.SystemClock;
Android官方文档:
public static long elapsedRealtime ()
Returns milliseconds since boot, including time spent in sleep.
返回Android系统启动至今的时间。
public static void sleep (long ms)
Waits a given number of milliseconds (of uptimeMillis) before returning. Similar to sleep(long)
, but does not throw InterruptedException
; interrupt()
events are deferred until the next interruptible operation. Does not return until at least the specified number of milliseconds has elapsed.
与Java Thread.sleep(long ms)基本相似,但是Android的SystemClock忽略InterruptedException。