From: terencehill Date: Tue, 26 Apr 2022 15:31:31 +0000 (+0200) Subject: Rename the seconds variable as it doesn't contain number of seconds X-Git-Tag: xonotic-v0.8.5~17^2~1 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=a6f73bc32f05b1bc211f1092666bbd726b6ba7c2 Rename the seconds variable as it doesn't contain number of seconds --- diff --git a/qcsrc/lib/string.qh b/qcsrc/lib/string.qh index 79ba56ebe9..6a37d5edd4 100644 --- a/qcsrc/lib/string.qh +++ b/qcsrc/lib/string.qh @@ -146,11 +146,11 @@ string clockedtime_tostring(int tm, bool hundredths) if (tm < 0) return strcat("0:00:0", hundredths ? "0" : ""); int acc = hundredths ? 6000 : 600; - int seconds = floor(tm + 0.5); - int minutes = floor(seconds / acc); - seconds -= minutes * acc; + tm = floor(tm + 0.5); + int minutes = floor(tm / acc); + int tm_without_minutes = tm - minutes * acc; // NOTE: the start digit of s is a placeholder and won't be displayed - string s = ftos(acc * 10 + seconds); + string s = ftos(acc * 10 + tm_without_minutes); return strcat(ftos(minutes), ":", substring(s, 1, 2), ".", substring(s, 3, hundredths ? 2 : 1)); }