From: havoc Date: Wed, 17 Nov 2004 15:42:39 +0000 (+0000) Subject: made dedicated servers hog a whole lot less CPU time X-Git-Tag: xonotic-v0.1.0preview~5370 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=5e20bfd1146312b43ea9cad50e4cc47c3900c3f7 made dedicated servers hog a whole lot less CPU time git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4765 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/host.c b/host.c index 194ba39f..94d097f8 100644 --- 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.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; }