You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to display the uptime, which is quite a common information to display on such devices.
I tried by myself, adding stuff in library/sensors/sensors.py and library/stats.py, but I failed miserably. That sounds quite easy to do if you know the code better than I do.
I couldn't find any pythonish way of getting the current uptime, but this code does the trick on linux:
from datetime import timedelta
with open('/proc/uptime', 'r') as f: uptime_s = float(f.readline().split()[0])
uptime_string = str(timedelta(seconds=uptime_s))
The text was updated successfully, but these errors were encountered:
I want to display the uptime, which is quite a common information to display on such devices.
I tried by myself, adding stuff in
library/sensors/sensors.py
andlibrary/stats.py
, but I failed miserably. That sounds quite easy to do if you know the code better than I do.I couldn't find any pythonish way of getting the current uptime, but this code does the trick on linux:
The text was updated successfully, but these errors were encountered: