Replace Python 2.7+ timedelta call with code that also works in older versions

This commit is contained in:
Sven Slootweg 2013-05-29 19:58:11 +02:00
parent 3f4a1e15d7
commit 42cb26f273

View file

@ -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,