Template
1
0

don't print a line every second while waiting for hours, just count down the last 10-70 seconds

This commit is contained in:
Stefan Harmuth 2023-12-01 17:30:55 +01:00
parent cab9cfe529
commit ee0b86bc7e

View File

@ -5,6 +5,7 @@ from os.path import exists
from platform import system from platform import system
from subprocess import call from subprocess import call
from time import sleep from time import sleep
from tools.tools import human_readable_time_from_delta
import webbrowser import webbrowser
@ -37,9 +38,15 @@ if start > now:
print("Do you really want to wait %d days?" % time_wait.days) print("Do you really want to wait %d days?" % time_wait.days)
exit() exit()
for x in range(time_wait.seconds, -1, -1): while time_wait.seconds > 0:
print("Day starts in %02ds.\r" % x) print("Day %d starts in %s.\r" % (DAY, human_readable_time_from_delta(time_wait)))
if time_wait.seconds > 70:
wait = min(1, time_wait.seconds // 3600) * 3600 + min(1, time_wait.seconds // 60) * 60
sleep(wait)
else:
sleep(1) sleep(1)
time_wait = start - datetime.now()
with open("skel_day.py", "r") as IN: with open("skel_day.py", "r") as IN:
with open(day_file, "w") as OUT: with open(day_file, "w") as OUT: