So far I did something like this:
import datetime as dt
import time, sys
start = time.time()
while True:
now = time.time()
delta = dt.timedelta(seconds=int(now - start))
sys.stdout.write('\r\033[2K' + str(delta))
time.sleep(.1)
But it prints it as a simple H:M:S method 0:11:11
and I need to do something like 3d, 21h, 46m, 12s
that automatically filters out some output if the value is still 0.
How can I do that?