diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2023-11-05 17:03:30 +0100 |
---|---|---|
committer | cgzones <cgzones@googlemail.com> | 2024-03-27 19:49:23 +0100 |
commit | ec608672cea2b857a7b43832bfabae2bbe6c04da (patch) | |
tree | 81621b9f7e922273606969640257d05fa0208074 | |
parent | 4e340c1817aaf61068aa746aad00197d969250b3 (diff) |
Short circuit zero time in Row_printTime()
Bail out early if the passed time is 0 and shadow the result.
-rw-r--r-- | Row.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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]; |