From: Matthijs Kooijman Date: Mon, 11 Jun 2007 20:00:12 +0000 (+0200) Subject: * Don't sleep for negative amounts (overflows to very large sleep delays :-) X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=5ddbdf638ea3b2fe93de5b7746ac827c21fc5633;p=matthijs%2FABM2.git * Don't sleep for negative amounts (overflows to very large sleep delays :-) --- diff --git a/ABM2/Engine/Kernel.cpp b/ABM2/Engine/Kernel.cpp index 06269d3..35d4afc 100755 --- a/ABM2/Engine/Kernel.cpp +++ b/ABM2/Engine/Kernel.cpp @@ -67,7 +67,9 @@ int CKernel::Execute() } IMMObject::CollectGarbage(); DWORD end_point = GetTickCount(); - Sleep(50 - (end_point-starting_point)); + /* Sleep if we didn't use up too much time already */ + if (starting_point + 50 > end_point) + Sleep(50 - (end_point-starting_point)); } #ifdef _DEBUG CProfileSample::Output();