In linux, the command "
$ cat /proc/uptime" shows how long the system has been on since it was last restarted. ~
http://en.wikipedia.org/wiki/Uptime#Using_uptime
This Python example code get uptime in second, run on Raspberry Pi:
import os
uptime = os.popen("awk '{print $1}' /proc/uptime").readline()
print("uptime(sec) = "+uptime)
No comments:
Post a Comment