X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;ds=sidebyside;f=ABM2%2FEngine%2FKernel.cpp;h=35d4afce603cc425a1fe83b2275477380459315b;hb=c100d6f67b06abb348319e277a66b6b7ab0c4bd5;hp=7638ab10c0c725094ccf9c7638b182f0f53904c1;hpb=784aa42247545bf80768602a32fbad922bb7d4c3;p=matthijs%2FABM2.git diff --git a/ABM2/Engine/Kernel.cpp b/ABM2/Engine/Kernel.cpp index 7638ab1..35d4afc 100755 --- a/ABM2/Engine/Kernel.cpp +++ b/ABM2/Engine/Kernel.cpp @@ -34,7 +34,7 @@ int CKernel::Execute() { PROFILE("Kernel task loop"); - //DWORD starting_point = GetTickCount(); + DWORD starting_point = GetTickCount(); #ifdef WIN32 if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) @@ -66,8 +66,10 @@ int CKernel::Execute() } } IMMObject::CollectGarbage(); - //DWORD end_point = GetTickCount(); -// Sleep(50 - (end_point-starting_point)); + DWORD end_point = GetTickCount(); + /* 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();