1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-08-08 22:36:48 +02:00

fix issue when there is no data

This commit is contained in:
Kelly Brazil
2021-03-25 11:17:44 -07:00
parent e9febe98ac
commit 099ae3fde0

View File

@@ -72,7 +72,7 @@ def process(proc_data):
"time": string,
"time_hour": integer,
"time_minute": integer,
"time_second": integer,
"time_second": integer, # null if not displayed
"uptime": string,
"uptime_days": integer, # new
"uptime_hours": integer, # new
@@ -90,18 +90,22 @@ def process(proc_data):
proc_data['time_minute'] = int(time_list[1])
if len(time_list) == 3:
proc_data['time_second'] = int(time_list[2])
else:
proc_data['time_second'] = None
# parse the uptime field
# parse the uptime field. Here are the variations:
# 0 min
# 3 mins
# 3 days, 2:54
# 2 days, 19:32
# 1 day, 29 min
# 16:59
if 'uptime' in proc_data:
uptime_days = 0
uptime_hours = 0
uptime_minutes = 0
uptime_total_seconds = 0
if 'min' in proc_data['uptime']:
uptime_minutes = int(proc_data['uptime'].split()[-2])