From: havoc Date: Tue, 1 Nov 2005 09:57:40 +0000 (+0000) Subject: made timing even more reliable (now sleeps only as little as possible, and only if... X-Git-Tag: xonotic-v0.1.0preview~4499 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=56a86085a581497c33bec48d52e3d06353920bec;p=xonotic%2Fdarkplaces.git made timing even more reliable (now sleeps only as little as possible, and only if at least 10ms remains) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5785 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/host.c b/host.c index 05bcd3ed..ae8f61be 100644 --- a/host.c +++ b/host.c @@ -586,12 +586,17 @@ qboolean Host_FilterTime (double time) timeleft = timecap - (realtime - oldrealtime); if (timeleft > 0) { +#if 1 + if (timeleft * 1000 >= 10) + Sys_Sleep(1); +#else int msleft; // don't totally hog the CPU // try to hit exactly a steady framerate by not sleeping the full amount msleft = (int)floor(timeleft * 1000); if (msleft >= 10) Sys_Sleep(msleft); +#endif return false; }