from math import floor
import time, decimal
from IPython.display import clear_output

min = 0
sec = 0
mil = 0
hour = 0
day = 0
on = True

while on == True:
    time.sleep(0.1)
    mil = mil + 1
    if mil == 10:
        mil = 0
        sec = sec + 1
        if sec == 60:
            sec = 0
            min = min + 1
            if min == 60:
                min = 0
                hour = hour + 1
                if hour == 24:
                    hour = 0
                    day = day + 1
    print(day,"d",hour,"h",min,"m",sec,".",mil,"s                    ", end = '\r')
    
0 d 0 h 1 m 55 . 7 s                    
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
/home/dreamerblock/L/_notebooks/2022-9-15-timer.ipynb Cell 1 in <cell line: 12>()
     <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/2022-9-15-timer.ipynb#W0sdnNjb2RlLXJlbW90ZQ%3D%3D?line=9'>10</a> on = True
     <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/2022-9-15-timer.ipynb#W0sdnNjb2RlLXJlbW90ZQ%3D%3D?line=11'>12</a> while on == True:
---> <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/2022-9-15-timer.ipynb#W0sdnNjb2RlLXJlbW90ZQ%3D%3D?line=12'>13</a>     time.sleep(0.1)
     <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/2022-9-15-timer.ipynb#W0sdnNjb2RlLXJlbW90ZQ%3D%3D?line=13'>14</a>     mil = mil + 1
     <a href='vscode-notebook-cell://wsl%2Bubuntu/home/dreamerblock/L/_notebooks/2022-9-15-timer.ipynb#W0sdnNjb2RlLXJlbW90ZQ%3D%3D?line=14'>15</a>     if mil == 10:

KeyboardInterrupt: