diff --git a/src/engine/qcommon/common.cpp b/src/engine/qcommon/common.cpp index b29b1d1305..9fdfe292ef 100644 --- a/src/engine/qcommon/common.cpp +++ b/src/engine/qcommon/common.cpp @@ -873,11 +873,15 @@ void Com_Frame() msec = com_frameTime - lastTime; + // For framerates up to 250fps, sleep until 1ms is remaining + // use extra margin of 2ms when looking for an higher framerate. + int margin = minMsec > 3 ? 1 : 2; + while ( msec < minMsec ) { // Never sleep more than 50ms. - // Never sleep when there is 2ms or less remaining. - int sleep = std::max( std::min( minMsec - msec, 50 ) - 2, 0 ); + // Never sleep when there is only “margin” left or less remaining. + int sleep = std::max( std::min( minMsec - msec, 50 ) - margin, 0 ); if ( sleep ) {