Return "0s" from utils.to_pretty_time when given 0 seconds
This commit is contained in:
parent
03a1f62297
commit
d86a0fc55c
1 changed files with 3 additions and 0 deletions
|
@ -62,6 +62,9 @@ UNIT_DAY = 2
|
||||||
UNIT_WEEK = 1
|
UNIT_WEEK = 1
|
||||||
def to_pretty_time(total_seconds: int, minimum_unit: int=UNIT_SECOND,
|
def to_pretty_time(total_seconds: int, minimum_unit: int=UNIT_SECOND,
|
||||||
max_units: int=UNIT_MINIMUM) -> str:
|
max_units: int=UNIT_MINIMUM) -> str:
|
||||||
|
if total_seconds == 0:
|
||||||
|
return "0s"
|
||||||
|
|
||||||
minutes, seconds = divmod(total_seconds, 60)
|
minutes, seconds = divmod(total_seconds, 60)
|
||||||
hours, minutes = divmod(minutes, 60)
|
hours, minutes = divmod(minutes, 60)
|
||||||
days, hours = divmod(hours, 24)
|
days, hours = divmod(hours, 24)
|
||||||
|
|
Loading…
Reference in a new issue