From befd5424dac3c51149eb588b4823aabeb68afcea Mon Sep 17 00:00:00 2001 From: 100620 <70658588+100620@users.noreply.github.com> Date: Wed, 2 Sep 2020 19:47:43 +0200 Subject: [PATCH] Fixed hours accumulation with seconds >= 3600 * 24 --- python/ego/output.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python/ego/output.py b/python/ego/output.py index a0cfe3f..aa33f13 100644 --- a/python/ego/output.py +++ b/python/ego/output.py @@ -26,7 +26,13 @@ def ago(diff): if diff.days == 1: out += "1 day" elif diff.days: - out += "%s days" % diff.days + if diff.seconds / 3600 >= 24: + # If there more than 24 hours stored in diff.seconds + days_to_add = int(diff.seconds / (3600 * 24)) + diff.seconds %= 3600 * 24 + else: + days_to_add = 0 + out += "%s days" % (diff.days + days_to_add) if diff.seconds / 3600 >= 1: if len(out): out += " "