From ec809b7f71f21c93c96398caa552eab486c3423d Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Wed, 13 Apr 2022 07:25:09 +0200 Subject: Avoid extremely large year values when printing time --- Process.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Process.c b/Process.c index c8c2aa91..6c7b3263 100644 --- a/Process.c +++ b/Process.c @@ -211,7 +211,12 @@ void Process_printTime(RichString* str, unsigned long long totalHundredths, bool int years = days / 365; int daysLeft = days - 365 * years; - if (daysLeft >= 100) { + if (years >= 10000000) { + RichString_appendnAscii(str, yearColor, "eternity ", 9); + } else if (years >= 1000) { + len = xSnprintf(buffer, sizeof(buffer), "%7dy ", years); + RichString_appendnAscii(str, yearColor, buffer, len); + } else if (daysLeft >= 100) { len = xSnprintf(buffer, sizeof(buffer), "%3dy", years); RichString_appendnAscii(str, yearColor, buffer, len); len = xSnprintf(buffer, sizeof(buffer), "%3dd ", daysLeft); -- cgit v1.2.3