Files
linux-workspace/bin/tss
2020-11-04 13:37:36 +01:00

18 lines
372 B
Python
Executable File

#!/usr/bin/env python3
from sys import stdin, stdout, argv
from time import time
detailed = '-d' in argv
start = time()
last = start
for line in stdin:
now = time()
duration = now - start
diff = now - last
last = now
if detailed:
stdout.write(f"{duration:0.6f} [{diff:0.6f}] {line}")
else:
stdout.write(f"{duration:0.6f} {line}")