From a0aa1c87c7612727bc38b4bb3f507eaa707fb67e Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Wed, 6 Sep 2017 09:09:17 +0200 Subject: [PATCH] Change the global timing in main() from milli- to microseconds. This is a no-op for now. We need this to get a much higher precision when calculating the frame times. This changes the fixedtime cvar from milli- to microseconds. --- src/backends/unix/main.c | 8 ++++---- src/common/misc.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backends/unix/main.c b/src/backends/unix/main.c index ab742309..77ebaaa4 100644 --- a/src/backends/unix/main.c +++ b/src/backends/unix/main.c @@ -38,7 +38,7 @@ qboolean is_portable; int main(int argc, char **argv) { - int time, oldtime, newtime; + long long time, oldtime, newtime; int verLen, i; const char* versionString; @@ -134,7 +134,7 @@ main(int argc, char **argv) /* Do not delay reads on stdin*/ fcntl(fileno(stdin), F_SETFL, fcntl(fileno(stdin), F_GETFL, NULL) | FNDELAY); - oldtime = Sys_Milliseconds(); + oldtime = Sys_Microseconds(); t.tv_sec = 0; /* The legendary Quake II mainloop */ @@ -149,10 +149,10 @@ main(int argc, char **argv) nanosleep(&t, NULL); #endif - newtime = Sys_Milliseconds(); + newtime = Sys_Microseconds(); time = newtime - oldtime; } - while (time < 1); + while (time < 1000); Qcommon_Frame(time); oldtime = newtime; diff --git a/src/common/misc.c b/src/common/misc.c index a5578fe3..046ddd26 100644 --- a/src/common/misc.c +++ b/src/common/misc.c @@ -388,7 +388,7 @@ Qcommon_Frame(int msec) time_between = Sys_Milliseconds(); } - CL_Frame(msec); + CL_Frame(msec / 1000); if (host_speeds->value) {