summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2022-04-13 07:25:09 +0200
committerBenBE <BenBE@geshi.org>2022-04-21 08:56:56 +0200
commitec809b7f71f21c93c96398caa552eab486c3423d (patch)
tree15e6b1de376aac99674cfdd633aa7077728f4407
parentb83ce85d89c6d368ffb8146043b878a441226ada (diff)
Avoid extremely large year values when printing time
-rw-r--r--Process.c7
1 files changed, 6 insertions, 1 deletions
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);

© 2014-2024 Faster IT GmbH | imprint | privacy policy