From 482683d5b6c7726d2af3b45469366f09f7cc7830 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 5 Mar 2022 19:38:44 +0100 Subject: [PATCH] Don't show "0 seconds" in human readable time format, unless time is 0 --- qcsrc/lib/counting.qh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/qcsrc/lib/counting.qh b/qcsrc/lib/counting.qh index c084b5efe..58588971b 100644 --- a/qcsrc/lib/counting.qh +++ b/qcsrc/lib/counting.qh @@ -117,10 +117,10 @@ string count_fill(float interval, string zeroth, string first, string second, st } ERASEABLE -string process_time(float outputtype, float seconds) +string process_time(float outputtype, int seconds) { - float tmp_hours = 0, tmp_minutes = 0, tmp_seconds = 0; - float tmp_years = 0, tmp_weeks = 0, tmp_days = 0; + int tmp_hours = 0, tmp_minutes = 0, tmp_seconds = 0; + int tmp_years = 0, tmp_weeks = 0, tmp_days = 0; tmp_seconds = floor(seconds); @@ -160,7 +160,8 @@ string process_time(float outputtype, float seconds) { string output = ""; - output = count_seconds(tmp_seconds); + if (tmp_seconds) + output = count_seconds(tmp_seconds); if (tmp_minutes) { @@ -197,6 +198,9 @@ string process_time(float outputtype, float seconds) ((output != "") ? strcat(", ", output) : "")); } + if (output == "") + return count_seconds(0); + return output; } case 3: -- 2.39.2