From 9da56ba8c1a3b73266cbe0876f32e8a3d2e76ce6 Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 1 Nov 2005 09:52:47 +0000 Subject: [PATCH] fix dedicated server timing, now sleeps less than the full amount of time (like listen servers/clients already did) to maintain a steady framerate, also made it not sleep unless it is at least 10ms, to try to further improve the timing accuracy, thanks to GreEn`mArine for testing this change git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5784 d7cf8633-e32d-0410-b094-e92efae38249 --- host.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/host.c b/host.c index 97b51e24..05bcd3ed 100644 --- a/host.c +++ b/host.c @@ -588,20 +588,9 @@ qboolean Host_FilterTime (double time) { int msleft; // don't totally hog the CPU - if (cls.state == ca_dedicated) - { - // if dedicated, try to use as little cpu as possible by waiting - // just a little longer than necessary - // (yes this means it doesn't quite keep up with the framerate) - msleft = (int)ceil(timeleft * 1000); - } - else - { - // if not dedicated, try to hit exactly a steady framerate by not - // sleeping the full amount - msleft = (int)floor(timeleft * 1000); - } - if (msleft > 0) + // try to hit exactly a steady framerate by not sleeping the full amount + msleft = (int)floor(timeleft * 1000); + if (msleft >= 10) Sys_Sleep(msleft); return false; } -- 2.39.2