diff --git a/src/client/game.cpp b/src/client/game.cpp index bdd2db947..32787cad3 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -4262,8 +4262,8 @@ void FpsControl::limit(IrrlichtDevice *device, f32 *dtime) if (busy_time < frametime_min) { sleep_time = frametime_min - busy_time; - if (sleep_time > 1000) - sleep_ms(sleep_time / 1000); + if (sleep_time > 0) + sleep_us(sleep_time); } else { sleep_time = 0; } diff --git a/src/porting.h b/src/porting.h index 1617fd644..da9f83eab 100644 --- a/src/porting.h +++ b/src/porting.h @@ -46,6 +46,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #define sleep_ms(x) Sleep(x) + #define sleep_us(x) Sleep((x)/1000) #else #include #include //for uintptr_t @@ -58,7 +59,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #define _GNU_SOURCE #endif - #define sleep_ms(x) usleep(x*1000) + #define sleep_ms(x) usleep((x)*1000) + #define sleep_us(x) usleep(x) #endif #ifdef _MSC_VER