From d86a0fc55cd22e9b9713cc526e805cfce93512dc Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 7 Feb 2019 22:47:03 +0000 Subject: [PATCH] Return "0s" from utils.to_pretty_time when given 0 seconds --- src/utils/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils/__init__.py b/src/utils/__init__.py index d76f020f..c9a42935 100644 --- a/src/utils/__init__.py +++ b/src/utils/__init__.py @@ -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)