Tweak the display time to use datetime.timedelta() instead of rolling my own with divmod() and friends
This commit is contained in:
parent
fb617a5eec
commit
5637ec322a
|
@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue