fix: wrong uptime in lxc container

This commit is contained in:
xcsoft
2022-06-20 20:52:54 +08:00
committed by GitHub
parent 3c771f9b5c
commit 669f008a8c
+6 -3
View File
@@ -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