mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 01:29:26 +08:00
fix: wrong uptime in lxc container
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user