From: terencehill Date: Sat, 5 Mar 2022 18:38:44 +0000 (+0100) Subject: Don't show "0 seconds" in human readable time format, unless time is 0 X-Git-Tag: xonotic-v0.8.5~179 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=482683d5b6c7726d2af3b45469366f09f7cc7830;p=xonotic%2Fxonotic-data.pk3dir.git Don't show "0 seconds" in human readable time format, unless time is 0 --- 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: