diff options
author | Benny Baumann <BenBE@geshi.org> | 2022-04-13 07:25:09 +0200 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2022-04-21 08:56:56 +0200 |
commit | ec809b7f71f21c93c96398caa552eab486c3423d (patch) | |
tree | 15e6b1de376aac99674cfdd633aa7077728f4407 | |
parent | b83ce85d89c6d368ffb8146043b878a441226ada (diff) |
Avoid extremely large year values when printing time
-rw-r--r-- | Process.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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); |