From 814b1b5f2bc5624c65f041048673800630845fcd Mon Sep 17 00:00:00 2001 From: "Timothy C. McGrath" Date: Sat, 8 Jun 2002 23:29:19 +0000 Subject: [PATCH] Reworked logging and heartbeats so they use realtime again, instead of directly calling sys_doubletime () - managed to remove six calls. Proboably I should look through the code some more and find more ways to remove more calls ... The server works fine with them on my system as is, but I've gotten the impression from people in the know that spamming the clock this often is bound to cause non x86 arches to have problems. Tim McGrath (Misty) --- qw/source/sv_main.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index 19bbf7596..fb670a180 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -568,17 +568,16 @@ SV_CheckLog (void) // bump sequence if almost full, or ten minutes have passed and // there is something still sitting there if (sz->cursize > LOG_HIGHWATER - || (Sys_DoubleTime () - svs.logtime > LOG_FLUSH && sz->cursize)) { + || ((realtime - svs.logtime) > (LOG_FLUSH && sz->cursize)) + || (realtime - svs.logtime) < 0) { // swap buffers and bump sequence - svs.logtime = Sys_DoubleTime (); + svs.logtime = realtime; svs.logsequence++; sz = &svs.log[svs.logsequence & 1]; sz->cursize = 0; SV_Printf ("beginning fraglog sequence %i\n", svs.logsequence); } - } - /* SVC_Log @@ -2142,7 +2141,7 @@ SV_InitLocal (void) // init fraglog stuff svs.logsequence = 1; - svs.logtime = Sys_DoubleTime (); + svs.logtime = realtime; svs.log[0].data = svs.log_buf[0]; svs.log[0].maxsize = sizeof (svs.log_buf[0]); svs.log[0].cursize = 0; @@ -2166,10 +2165,9 @@ Master_Heartbeat (void) char string[2048]; int active, i; - if (Sys_DoubleTime () - svs.last_heartbeat < HEARTBEAT_SECONDS) + if ((realtime - svs.last_heartbeat) < HEARTBEAT_SECONDS) return; // not time to send yet - - svs.last_heartbeat = Sys_DoubleTime (); + svs.last_heartbeat = realtime; // count active users active = 0;