From 5637ec322a3ec48dc3b4a1284d7642c8aef96f44 Mon Sep 17 00:00:00 2001 From: David Thurstenson Date: Sat, 15 Oct 2022 07:07:49 -0500 Subject: [PATCH] Tweak the display time to use datetime.timedelta() instead of rolling my own with divmod() and friends --- colorbar-fastloop.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/colorbar-fastloop.py b/colorbar-fastloop.py index 04fbe5b..2facb96 100644 --- a/colorbar-fastloop.py +++ b/colorbar-fastloop.py @@ -131,9 +131,13 @@ def countdown( current_time -= update_interval # Massage the current_time seconds count into human-readable minutes:seconds - display_time = divmod(abs(current_time), 60) + display_time = str(datetime.timedelta(seconds=abs(current_time)))[3:] if current_time < 0: display_time_sign = "-" else: display_time_sign = " " - print("current time: " + display_time_sign + str(display_time[0]) + ":" + str(display_time[1])) + print("current time: " + display_time_sign + display_time) + + + +