From 56a86085a581497c33bec48d52e3d06353920bec Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 1 Nov 2005 09:57:40 +0000 Subject: [PATCH] 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 --- host.c | 5 +++++ 1 file changed, 5 insertions(+) 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; } -- 2.39.2