]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Don't show "0 seconds" in human readable time format, unless time is 0
authorterencehill <piuntn@gmail.com>
Sat, 5 Mar 2022 18:38:44 +0000 (19:38 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 5 Mar 2022 18:38:44 +0000 (19:38 +0100)
qcsrc/lib/counting.qh

index c084b5efe3a417b557202228d2b19ad98bf06a41..58588971b2ae6f90ba176204108b9caab28fe125 100644 (file)
@@ -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: