]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make the "time" command available to both cmd and sv_cmd as a common command
authorSamual <samual@xonotic.org>
Sat, 17 Dec 2011 12:50:30 +0000 (07:50 -0500)
committerSamual <samual@xonotic.org>
Sat, 17 Dec 2011 12:50:30 +0000 (07:50 -0500)
qcsrc/server/command/cmd.qc
qcsrc/server/command/common.qc
qcsrc/server/command/sv_cmd.qc

index c5f10826b60bf6671360196f68354954af2c50c9..e9052c0cfb332b70b2d6708a1a3924c7c816d0c4 100644 (file)
@@ -560,6 +560,7 @@ void ClientCommand_(float request)
        CLIENT_COMMAND("suggestmap", ClientCommand_suggestmap(request, arguments), "Suggest a map to the mapvote at match end") \
        CLIENT_COMMAND("teamstatus", CommonCommand_teamstatus(request), "Show information about player and team scores") \
        CLIENT_COMMAND("tell", ClientCommand_tell(request, arguments, command), "Send a message directly to a player") \
+       CLIENT_COMMAND("time", CommonCommand_time(request), "Print different formats/readouts of time") \
        CLIENT_COMMAND("timein", CommonCommand_timein(request), "Resume the game from being paused with a timeout") \
        CLIENT_COMMAND("timeout", CommonCommand_timeout(request), "Call a timeout which pauses the game for certain amount of time unless unpaused") \
        CLIENT_COMMAND("voice", ClientCommand_voice(request, arguments, command), "Send voice message via sound") \
index c31dd6c4f7b4889f6001d68f10e60189e72ecded..ea6791807c1227694f7b9128a192f22c60c55bfb 100644 (file)
@@ -294,6 +294,31 @@ void CommonCommand_teamstatus(float request)
        }
 }
 
+void CommonCommand_time(float request)
+{
+       switch(request)
+       {
+               case CMD_REQUEST_COMMAND:
+               {
+                       print("time = ", ftos(time), "\n");
+                       print("frame start = ", ftos(gettime(GETTIME_FRAMESTART)), "\n");
+                       print("realtime = ", ftos(gettime(GETTIME_REALTIME)), "\n");
+                       print("hires = ", ftos(gettime(GETTIME_HIRES)), "\n");
+                       print("uptime = ", ftos(gettime(GETTIME_UPTIME)), "\n");
+                       print("localtime = ", strftime(TRUE, "%a %b %e %H:%M:%S %Z %Y"), "\n"); // todo: Why is strftime broken? is engine problem, I think.
+                       print("gmtime = ", strftime(FALSE, "%a %b %e %H:%M:%S %Z %Y"), "\n");
+                       return;
+               }
+                       
+               default:
+               case CMD_REQUEST_USAGE:
+               {
+                       print_to(self, "\nUsage:^3 cmd time");
+                       print_to(self, "  No arguments required.");
+                       return;
+               }
+       }
+}
 
 void CommonCommand_timein(float request)
 {
index 52de05f4066c143bd3735260088bf149ae46f585..a4060739dd8b848da840e326c2fcf227989336b3 100644 (file)
@@ -1445,32 +1445,6 @@ void GameCommand_stuffto(float request, float argc)
        #endif
 }
 
-void GameCommand_time(float request)
-{
-       switch(request)
-       {
-               case CMD_REQUEST_COMMAND:
-               {
-                       print("time = ", ftos(time), "\n");
-                       print("frame start = ", ftos(gettime(GETTIME_FRAMESTART)), "\n");
-                       print("realtime = ", ftos(gettime(GETTIME_REALTIME)), "\n");
-                       print("hires = ", ftos(gettime(GETTIME_HIRES)), "\n");
-                       print("uptime = ", ftos(gettime(GETTIME_UPTIME)), "\n");
-                       print("localtime = ", strftime(TRUE, "%a %b %e %H:%M:%S %Z %Y"), "\n"); // FIXME: Why is strftime broken? is engine problem, I think.
-                       print("gmtime = ", strftime(FALSE, "%a %b %e %H:%M:%S %Z %Y"), "\n");
-                       return;
-               }
-                       
-               default:
-               case CMD_REQUEST_USAGE:
-               {
-                       print("\nUsage:^3 sv_cmd time\n");
-                       print("  No arguments required.\n");
-                       return;
-               }
-       }
-}
-
 void GameCommand_trace(float request, float argc)
 {                                              
        switch(request)
@@ -1780,7 +1754,7 @@ void GameCommand_(float request)
        SERVER_COMMAND("shuffleteams", GameCommand_shuffleteams(request), "Randomly move players to different teams") \
        SERVER_COMMAND("stuffto", GameCommand_stuffto(request, arguments), "Send a command to be executed on a client") \
        SERVER_COMMAND("teamstatus", CommonCommand_teamstatus(request), "Show information about player and team scores") \
-       SERVER_COMMAND("time", GameCommand_time(request), "Print different formats/readouts of time") \
+       SERVER_COMMAND("time", CommonCommand_time(request), "Print different formats/readouts of time") \
        SERVER_COMMAND("timein", CommonCommand_timein(request), "Resume the game from being paused with a timeout") \
        SERVER_COMMAND("timeout", CommonCommand_timeout(request), "Call a timeout which pauses the game for certain amount of time unless unpaused") \
        SERVER_COMMAND("trace", GameCommand_trace(request, arguments), "Various debugging tools with tracing") \