How to get Android system uptime and realtime from command line?

邮差的信 提交于 2019-12-03 18:03:59

问题


I'm writing a script containing several "adb shell" command. I also want to record the time when program execute these command in a form of realtime and uptime. I know I can get uptime and realtime through SystemClock:

SystemClock.uptimeMillis();
SystemClock.elapsedRealtime();

Is there any way I can get these information from the command line?

Thanks a lot!


回答1:


Try:

adb shell cat /proc/uptime



回答2:


If you only need to-the-second accuracy, adb shell uptime will also work. Example output:

up time: 00:09:26, idle time: 00:07:15, sleep time: 00:00:00


来源:https://stackoverflow.com/questions/18135966/how-to-get-android-system-uptime-and-realtime-from-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!