]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/util.qc
Merge remote-tracking branch 'origin/master' into TimePath/combined_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / util.qc
index 15cde708ab84978e148be46ae7abf388c7ea33b7..4a8aef6517828548d6acae346bec671b5b51ec80 100644 (file)
@@ -408,6 +408,22 @@ void buf_save(float buf, string pFilename)
        fclose(fh);
 }
 
+string format_time(float seconds)
+{
+       float days, hours, minutes;
+       seconds = floor(seconds + 0.5);
+        days = floor(seconds / 864000);
+        seconds -= days * 864000;
+        hours = floor(seconds / 36000);
+        seconds -= hours * 36000;
+       minutes = floor(seconds / 600);
+       seconds -= minutes * 600;
+        if (days > 0)
+                return sprintf(_("%d days, %02d:%02d:%02d"), days, hours, minutes, seconds);
+        else
+                return sprintf(_("%02d:%02d:%02d"), hours, minutes, seconds);
+}
+
 string mmsss(float tenths)
 {
        float minutes;
@@ -2585,7 +2601,6 @@ vector get_corner_position(entity box, float corner)
 #endif
 
 // todo: this sucks, lets find a better way to do backtraces?
-#ifndef MENUQC
 void backtrace(string msg)
 {
        float dev, war;
@@ -2607,7 +2622,6 @@ void backtrace(string msg)
        cvar_set("developer", ftos(dev));
        cvar_set("prvm_backtraceforwarnings", ftos(war));
 }
-#endif
 
 // color code replace, place inside of sprintf and parse the string
 string CCR(string input)