diff options
| author | 2019-02-07 22:47:03 +0000 | |
|---|---|---|
| committer | 2019-02-07 22:47:03 +0000 | |
| commit | d86a0fc55cd22e9b9713cc526e805cfce93512dc (patch) | |
| tree | 5f377487c9223da816e9ff417bfe911858ff44b3 | |
| parent | Script travis module in favour of github webhook `check_run` events (diff) | |
| signature | ||
Return "0s" from utils.to_pretty_time when given 0 seconds
| -rw-r--r-- | src/utils/__init__.py | 3 |
1 files changed, 3 insertions, 0 deletions
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) |
