for proc in psutil.process_iter():
if proc.name == "monit":
current_time = time.localtime()
proc_start_time = time.localtime(proc.create_time)
print (current_time - proc_start_time).seconds
I am not able to find difference between two datetimes. Can't subtract them give Error -
TypeError: unsupported operand type(s) for -: 'time.struct_time' and 'time.struct_time'