mirror of
https://github.com/powerline/powerline.git
synced 2025-07-30 01:05:42 +02:00
Use psutil.boot_time() function if appropriate
It now replaced psutil.BOOT_TIME attribute. Fixes #1391
This commit is contained in:
parent
b789437ce1
commit
248c2f8063
@ -131,10 +131,12 @@ if os.path.exists('/proc/uptime'):
|
|||||||
elif 'psutil' in globals():
|
elif 'psutil' in globals():
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
def _get_uptime():
|
if hasattr(psutil, 'boot_time'):
|
||||||
# psutil.BOOT_TIME is not subject to clock adjustments, but time() is.
|
def _get_uptime():
|
||||||
# Thus it is a fallback to /proc/uptime reading and not the reverse.
|
return int(time() - psutil.boot_time())
|
||||||
return int(time() - psutil.BOOT_TIME)
|
else:
|
||||||
|
def _get_uptime():
|
||||||
|
return int(time() - psutil.BOOT_TIME)
|
||||||
else:
|
else:
|
||||||
def _get_uptime():
|
def _get_uptime():
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
Loading…
x
Reference in New Issue
Block a user