diff --git a/src/backends/unix/main.c b/src/backends/unix/main.c index 3388cea5..96ccd7e4 100644 --- a/src/backends/unix/main.c +++ b/src/backends/unix/main.c @@ -26,9 +26,8 @@ */ #include -#include #include -#include +#include #include #include "../../common/header/common.h" @@ -40,6 +39,7 @@ main(int argc, char **argv) int time, oldtime, newtime; int verLen, i; const char* versionString; + struct timespec t; /* register signal handler */ registerHandler(); @@ -123,6 +123,7 @@ main(int argc, char **argv) fcntl(fileno(stdin), F_SETFL, fcntl(fileno(stdin), F_GETFL, NULL) | FNDELAY); oldtime = Sys_Milliseconds(); + t.tv_sec = 0; /* The legendary Quake II mainloop */ while (1) @@ -130,6 +131,10 @@ main(int argc, char **argv) /* find time spent rendering last frame */ do { + /* Sleep 10 microseconds */ + t.tv_nsec = 10000; + nanosleep(&t, NULL); + newtime = Sys_Milliseconds(); time = newtime - oldtime; }