Return "0s" from utils.to_pretty_time when given 0 seconds

This commit is contained in:
jesopo 2019-02-07 22:47:03 +00:00
parent 03a1f62297
commit d86a0fc55c

View file

@ -62,6 +62,9 @@ UNIT_DAY = 2
UNIT_WEEK = 1
def to_pretty_time(total_seconds: int, minimum_unit: int=UNIT_SECOND,
max_units: int=UNIT_MINIMUM) -> str:
if total_seconds == 0:
return "0s"
minutes, seconds = divmod(total_seconds, 60)
hours, minutes = divmod(minutes, 60)
days, hours = divmod(hours, 24)