From: Samual <samual@xonotic.org>
Date: Sat, 17 Dec 2011 12:50:30 +0000 (-0500)
Subject: Make the "time" command available to both cmd and sv_cmd as a common command
X-Git-Tag: xonotic-v0.6.0~188^2~28^2~125
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8e028a69736a7cf6b72da7810d2a6b974f554144;p=xonotic%2Fxonotic-data.pk3dir.git

Make the "time" command available to both cmd and sv_cmd as a common command
---

diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc
index c5f10826b6..e9052c0cfb 100644
--- a/qcsrc/server/command/cmd.qc
+++ b/qcsrc/server/command/cmd.qc
@@ -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") \
diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc
index c31dd6c4f7..ea6791807c 100644
--- a/qcsrc/server/command/common.qc
+++ b/qcsrc/server/command/common.qc
@@ -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)
 {
diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc
index 52de05f406..a4060739dd 100644
--- a/qcsrc/server/command/sv_cmd.qc
+++ b/qcsrc/server/command/sv_cmd.qc
@@ -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") \