From 42db4d0cd2fdbaac5f9fbea974196c8edfe5c987 Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Sun, 3 Jun 2012 14:19:30 +0200 Subject: [PATCH] Implement Sys_Milliseconds This function was taken from ioQuakeII and refactored to match Yamagi Quake II --- src/windows/system.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/windows/system.c b/src/windows/system.c index c55a171e..2157cb6b 100644 --- a/src/windows/system.c +++ b/src/windows/system.c @@ -40,6 +40,7 @@ #define MAX_NUM_ARGVS 128 +int curtime; int starttime; qboolean ActiveApp; qboolean Minimized; @@ -484,6 +485,27 @@ ParseCommandLine(LPSTR lpCmdLine) } } +/* ======================================================================= */ + +int +Sys_Milliseconds(void) +{ + static int base; + static qboolean initialized = false; + + if (!initialized) + { /* let base retain 16 bits of effectively random data */ + base = timeGetTime() & 0xffff0000; + initialized = true; + } + + curtime = timeGetTime() - base; + + return curtime; +} + +/* ======================================================================= */ + /* * Windows main function. Containts the * initialization code and the main loop