[qw] Fix some server status output issues

The uptime display had not been updated for the offset Sys_DoubleTime,
so add Sys_DoubleTimeBase to make it easy to use Sys_DoubleTime as
uptime.

Line up the layout of the client list was not consistent for drop and
qport.
This commit is contained in:
Bill Currie 2021-07-11 08:18:02 +09:00
parent c4cc5b2756
commit 3c0ad2ca71
3 changed files with 11 additions and 3 deletions

View File

@ -80,6 +80,7 @@ void Sys_Shutdown (void);
void Sys_RegisterShutdown (void (*func) (void *), void *data); void Sys_RegisterShutdown (void (*func) (void *), void *data);
int64_t Sys_LongTime (void); int64_t Sys_LongTime (void);
double Sys_DoubleTime (void); double Sys_DoubleTime (void);
double Sys_DoubleTimeBase (void);
void Sys_TimeOfDay(date_t *date); void Sys_TimeOfDay(date_t *date);
void Sys_MaskPrintf (int mask, const char *fmt, ...) __attribute__((format(PRINTF,2,3))); void Sys_MaskPrintf (int mask, const char *fmt, ...) __attribute__((format(PRINTF,2,3)));

View File

@ -412,6 +412,12 @@ Sys_DoubleTime (void)
return (__INT64_C (4294967296000000) + Sys_LongTime ()) / 1e6; return (__INT64_C (4294967296000000) + Sys_LongTime ()) / 1e6;
} }
VISIBLE double
Sys_DoubleTimeBase (void)
{
return __INT64_C (4294967296000000) / 1e6;
}
VISIBLE void VISIBLE void
Sys_TimeOfDay (date_t *date) Sys_TimeOfDay (date_t *date)
{ {

View File

@ -390,7 +390,7 @@ SV_Current_Map (void)
} }
static const char * static const char *
nice_time (float time) nice_time (double time)
{ {
int t = time + 0.5; int t = time + 0.5;
@ -529,7 +529,8 @@ SV_Status_f (void)
pak = (float) svs.stats.latched_packets / STATFRAMES; pak = (float) svs.stats.latched_packets / STATFRAMES;
SV_Printf ("net address : %s\n", NET_AdrToString (net_local_adr)); SV_Printf ("net address : %s\n", NET_AdrToString (net_local_adr));
SV_Printf ("uptime : %s\n", nice_time (Sys_DoubleTime ())); SV_Printf ("uptime : %s\n",
nice_time (Sys_DoubleTime () - Sys_DoubleTimeBase ()));
SV_Printf ("cpu utilization : %3i%% (%3i%%)\n", (int) cpu, (int)demo); SV_Printf ("cpu utilization : %3i%% (%3i%%)\n", (int) cpu, (int)demo);
SV_Printf ("avg response time: %i ms\n", (int) avg); SV_Printf ("avg response time: %i ms\n", (int) avg);
SV_Printf ("packets/frame : %5.2f\n", pak); SV_Printf ("packets/frame : %5.2f\n", pak);
@ -602,7 +603,7 @@ SV_Status_f (void)
SV_Printf ("SERVER %d\n", cl->ping); SV_Printf ("SERVER %d\n", cl->ping);
continue; continue;
} }
SV_Printf ("%4i %4i %3.1f %4i", SV_Printf ("%4i %4i %4.1f%% %5i",
(int) (1000 * cl->netchan.frame_rate), (int) (1000 * cl->netchan.frame_rate),
(int) SV_CalcPing (cl), (int) SV_CalcPing (cl),
100.0 * cl->netchan.drop_count / 100.0 * cl->netchan.drop_count /