Skip to content

Add uptime information (on linux) #448

@orzel

Description

@orzel

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions