]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
made dedicated servers hog a whole lot less CPU time
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 17 Nov 2004 15:42:39 +0000 (15:42 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 17 Nov 2004 15:42:39 +0000 (15:42 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4765 d7cf8633-e32d-0410-b094-e92efae38249

host.c

diff --git a/host.c b/host.c
index 194ba39f3e474b8fe9b03fc6c798a6a82076fca2..94d097f83f14582dc2e8af26198f9d15ecbdb4ef 100644 (file)
--- a/host.c
+++ b/host.c
@@ -598,8 +598,13 @@ qboolean Host_FilterTime (double time)
        if (timeleft > 0)
        {
                // don't totally hog the CPU
        if (timeleft > 0)
        {
                // don't totally hog the CPU
-               if (timeleft >= 0.03)
-                       Sys_Sleep((int)(timeleft * 1000) - 10);
+               int msleft = (int)(timeleft * 1000);
+               // if not dedicated, try to hit exactly a steady framerate by by not
+               // sleeping the full amount
+               if (cls.state != ca_dedicated)
+                       msleft -= 1;
+               if (msleft > 0)
+                       Sys_Sleep(msleft);
                return false;
        }
 
                return false;
        }