Replace Python 2.7+ timedelta call with code that also works in older versions
This commit is contained in:
parent
3f4a1e15d7
commit
42cb26f273
|
@ -33,8 +33,10 @@ def generate_stats(get_processes):
|
|||
"free": usage.free
|
||||
}
|
||||
|
||||
uptime = (datetime.now() - datetime.fromtimestamp(psutil.BOOT_TIME))
|
||||
|
||||
return_data = {
|
||||
"uptime": (datetime.now() - datetime.fromtimestamp(psutil.BOOT_TIME)).total_seconds(),
|
||||
"uptime": (uptime.microseconds + (uptime.seconds + uptime.days * 24 * 3600) * 10**6) / 10**6,
|
||||
"memory": {
|
||||
"total": mem.total,
|
||||
"available": mem.available,
|
||||
|
|
Loading…
Reference in a new issue