From d4dfc5e4148c7b0629fbf7ec915836a3f6faa9ab Mon Sep 17 00:00:00 2001 From: div0 Date: Sat, 21 Mar 2009 22:12:11 +0000 Subject: [PATCH] DP_QC_GETTIME, sv_cmd time git-svn-id: svn://svn.icculus.org/nexuiz/trunk@6244 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/extensions.qh | 13 +++++++++++++ data/qcsrc/server/gamecommand.qc | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/data/qcsrc/server/extensions.qh b/data/qcsrc/server/extensions.qh index 5883b3fac..c04d000ab 100644 --- a/data/qcsrc/server/extensions.qh +++ b/data/qcsrc/server/extensions.qh @@ -763,6 +763,19 @@ vector gettaginfo_up; //gettaginfo_name is set to the name of the bone whose index had been specified in gettaginfo //gettaginfo_offset, gettaginfo_forward, gettaginfo_right, gettaginfo_up contain the transformation matrix of the bone relative to its parent. Note that the matrix may contain a scaling component. +//DP_QC_GETTIME +//idea: tZork +//darkplaces implementation: tZork, div0 +//constant definitions: +float GETTIME_FRAMESTART = 0; // time of start of frame +float GETTIME_REALTIME = 1; // current time (may be OS specific) +float GETTIME_HIRES = 2; // like REALTIME, but may reset between QC invocations and thus can be higher precision +float GETTIME_UPTIME = 3; // time since start of the engine +//builtin definitions: +float(float tmr) gettime = #519; +//description: +//some timers to query... + //DP_QC_MINMAXBOUND //idea: LordHavoc //darkplaces implementation: LordHavoc diff --git a/data/qcsrc/server/gamecommand.qc b/data/qcsrc/server/gamecommand.qc index 8817780fa..e482e9db5 100644 --- a/data/qcsrc/server/gamecommand.qc +++ b/data/qcsrc/server/gamecommand.qc @@ -859,6 +859,18 @@ void GameCommand(string command) return; } + if(argv(0) == "time") + { + 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"); + print("gmtime = ", strftime(FALSE, "%a %b %e %H:%M:%S %Z %Y"), "\n"); + return; + } + print("Invalid command. For a list of supported commands, try sv_cmd help.\n"); } -- 2.39.2