From caf8a2708b80fce40e6d833b3595a97fc4e3bd79 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Mon, 14 Jul 2025 22:04:22 -0700 Subject: [PATCH] Update log.py fix time display --- modules/log.py | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/modules/log.py b/modules/log.py index e8e44d0..f0ac37a 100644 --- a/modules/log.py +++ b/modules/log.py @@ -83,18 +83,14 @@ if log_messages_to_file: # Pretty Timestamp def getPrettyTime(seconds): - # convert unix time to minutes, hours, or days, or years for simple display - designator = "s" - if seconds > 0: - seconds = round(seconds / 60) - designator = "m" - if seconds > 60: - seconds = round(seconds / 60) - designator = "h" - if seconds > 24: - seconds = round(seconds / 24) - designator = "d" - if seconds > 365: - seconds = round(seconds / 365) - designator = "y" - return str(seconds) + designator \ No newline at end of file + # convert unix time to minutes, hours, days, or years for simple display + if seconds < 60: + return f"{int(seconds)}s" + elif seconds < 3600: + return f"{int(round(seconds / 60))}m" + elif seconds < 86400: + return f"{int(round(seconds / 3600))}h" + elif seconds < 31536000: + return f"{int(round(seconds / 86400))}d" + else: + return f"{int(round(seconds / 31536000))}y" \ No newline at end of file