rendered paste bodyimport re, os, timehz = 250def get_boot_time(): f = open('/proc/stat', 'r') x = f.readlines() f.close() re_c = re.compile('^btime (\d+)$') for line in x: m = re_c.match(line) if m: return int(m.group(1)) return Nonedef get_starttime(pid): f = open('/proc/' + str(pid) + '/stat', 'r') x = f.read().split(' ') f.close() # starttime return int(x[21].strip())print time.time()print get_boot_time()print get_starttime(os.getpid())/hz# running [s]print time.time() - (get_boot_time() + get_starttime(os.getpid())/hz)~