fix: wrong uptime in lxc container

pull/109/head
xcsoft 3 years ago committed by GitHub
parent 3c771f9b5c
commit 669f008a8c
  1. 9
      class/core/system_api.py

@ -250,9 +250,12 @@ class system_api:
def getBootTime(self):
# 取系统启动时间
start_time = psutil.boot_time()
run_time = time.time() - start_time
# conf = mw.readFile('/proc/uptime').split()
uptime = mw.readFile('/proc/uptime')
if uptime == False:
start_time = psutil.boot_time()
run_time = time.time() - start_time
else:
run_time = uptime.split()[0]
tStr = float(run_time)
min = tStr / 60
hours = min / 60

Loading…
Cancel
Save