androidadbandroid-shell

Android uptime in hour


I connect all our android devices through adb with WiFi. I am trying to get the uptime in hour. what i got now is in seconds.

adb connect 172.16.100.2
adb shell cat /proc/uptime > "C:\TimeLog.txt"
(or just adb shell uptime)
adb disconnect

The result is

258521.25 1019421.93
(or uptime: 2 days, 23:59:00, idle time: 11 days.....)

All I need is uptime in hour, I dont need 2nd part of time...

I also tried

adb shell awk '{print int($1/3600)":"int(($1%3600)/60)":"int($1%60)}' /proc/uptime

But /system/bin/sh: aws: not found

What else i can use with adb or shell on Android for getting uptime?

Also what command should i use to setup date/time on Android?


Solution

  • I am pretty sure that awk is not part of the default android installation. If you run linux you can use:

    adb shell cat /proc/uptime | awk ...