uptime (via status) for qw-server and map time and auto map start for

nq-server
This commit is contained in:
Bill Currie 2002-11-07 16:43:05 +00:00
parent 71e95ee26f
commit 8d736d7424
4 changed files with 31 additions and 3 deletions

3
NEWS
View file

@ -9,6 +9,9 @@ Changes from 0.5.2
* sv_maxrate changes now take effect immediately rather than when
clients (re)connect or change their rate
* segfault when using "snd_output null" fixed
* qw server "status" command now gives the server's uptime
* "map" will display the amount of time the current map has been active
* nq-server will now auto-load the start map if none is specified
o qfcc enhancements.
* @argc and @argv deprecated in favor of @args.count and @args.list

View file

@ -993,10 +993,17 @@ Host_Init (void)
Con_Printf ("\nVersion %s (build %04d)\n\n", VERSION,
build_number ());
Con_Printf ("\x80\x81\x81\x82 %s Initialized\x80\x81\x81\x82\n", PROGRAM);
Con_Printf ("\x80\x81\x81\x82 %s initialized\x80\x81\x81\x82\n", PROGRAM);
CL_UpdateScreen (cl.time);
Con_NewMap ();
if (isDedicated) {
if (!sv.active)
Cmd_ExecuteString ("map start", src_command);
if (!sv.active)
Sys_Error ("Could not initialize server");
} else {
Con_NewMap ();
}
CL_UpdateScreen (cl.time);
}

View file

@ -231,6 +231,23 @@ Host_Ping_f (void)
// SERVER TRANSITIONS =========================================================
static const char *
nice_time (float time)
{
int t = time + 0.5;
if (t < 60) {
return va ("%ds", t);
} else if (t < 3600) {
return va ("%dm%02ds", t / 60, t % 60);
} else if (t < 86400) {
return va ("%dh%02dm%02ds", t / 3600, (t / 60) % 60, t % 60);
} else {
return va ("%dd%02dh%02dm%02ds",
t / 86400, (t / 3600) % 24, (t / 60) % 60, t % 60);
}
}
/*
Host_Map_f
@ -254,7 +271,7 @@ Host_Map_f (void)
return;
}
if (Cmd_Argc () == 1) {
Con_Printf ("map is %s\n", sv.name);
Con_Printf ("map is %s (%s)\n", sv.name, nice_time (sv.time));
return;
}

View file

@ -474,6 +474,7 @@ SV_Status_f (void)
pak = (float) svs.stats.latched_packets / STATFRAMES;
SV_Printf ("net address : %s\n", NET_AdrToString (net_local_adr));
SV_Printf ("uptime : %s\n", nice_time (Sys_DoubleTime ()));
SV_Printf ("cpu utilization : %3i%% (%3i%%)\n", (int) cpu, (int)demo);
SV_Printf ("avg response time: %i ms\n", (int) avg);
SV_Printf ("packets/frame : %5.2f\n", pak);