From ec608672cea2b857a7b43832bfabae2bbe6c04da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Sun, 5 Nov 2023 17:03:30 +0100 Subject: [PATCH] Short circuit zero time in Row_printTime() Bail out early if the passed time is 0 and shadow the result. --- Row.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Row.c b/Row.c index f866c0f6..846a353d 100644 --- a/Row.c +++ b/Row.c @@ -337,6 +337,14 @@ void Row_printTime(RichString* str, unsigned long long totalHundredths, bool col char buffer[10]; int len; + if (totalHundredths == 0) { + int shadowColor = coloring ? CRT_colors[PROCESS_SHADOW] : CRT_colors[PROCESS]; + + len = xSnprintf(buffer, sizeof(buffer), " 0:00.00 "); + RichString_appendnAscii(str, shadowColor, buffer, len); + return; + } + int yearColor = coloring ? CRT_colors[LARGE_NUMBER] : CRT_colors[PROCESS]; int dayColor = coloring ? CRT_colors[PROCESS_GIGABYTES] : CRT_colors[PROCESS]; int hourColor = coloring ? CRT_colors[PROCESS_MEGABYTES] : CRT_colors[PROCESS];