From c80c2ba635d0cc560f3f468cfb93b4ba11e3b559 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Fri, 24 Nov 2017 14:38:55 -0500 Subject: [PATCH] - added 100% CPU fix provided by Leonard2: https://forum.zdoom.org/viewtopic.php?p=1028500#p1028500 --- src/i_time.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i_time.cpp b/src/i_time.cpp index 2aada4861..516ecfad1 100644 --- a/src/i_time.cpp +++ b/src/i_time.cpp @@ -132,7 +132,7 @@ int I_WaitForTic(int prevtic) { // The minimum amount of time a thread can sleep is controlled by timeBeginPeriod. // We set this to 1 ms in DoMain. - int sleepTime = prevtic - time; + uint64_t sleepTime = NSToMS(FirstFrameStartTime + TicToNS(prevtic + 1) - I_nsTime()); if (sleepTime > 2) std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime - 2)); @@ -154,7 +154,7 @@ uint64_t I_msTime() int I_GetTime() { - return NSToTic(CurrentFrameStartTime - FirstFrameStartTime) + 1; + return NSToTic(CurrentFrameStartTime - FirstFrameStartTime); } double I_GetTimeFrac()