fix bug for python3

This commit is contained in:
macos 2019-12-31 16:25:51 +08:00
parent 5e527ad369
commit 057ffa6303

@ -66,6 +66,7 @@ def get_time():
for i in range(len(time_list)) :
time_list[i] = int(time_list[i])
return time_list
def delta_time():
x = get_time()
time.sleep(INTERVAL)
@ -73,13 +74,14 @@ def delta_time():
for i in range(len(x)):
y[i]-=x[i]
return y
def get_cpu():
t = delta_time()
st = sum(t)
if st == 0:
st = 1
result = 100-(t[len(t)-1]*100.00/st)
return round(result)
return round(result, 1)
class Traffic:
def __init__(self):