From 9e5b7f430d3c5f30042c1fa380ed6b4be13c884d Mon Sep 17 00:00:00 2001 From: Steven Fuller Date: Wed, 8 Aug 2001 06:14:20 +0000 Subject: Moved inline assembly to a separate file for debugging. Implemented GetTickCount/timeGetTime. Added basic SDL/OpenGL support. Draws something with no optimizations, but draws nothing with -O2. (What is drawn looks like garbage.) --- src/winapi.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'src/winapi.c') diff --git a/src/winapi.c b/src/winapi.c index 6719293..dc3b97e 100644 --- a/src/winapi.c +++ b/src/winapi.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "fixer.h" @@ -182,16 +183,34 @@ int SetEndOfFile(HANDLE file) } /* time in miliseconds */ -int timeGetTime() +struct timeval tv0; + +unsigned int timeGetTime() { - fprintf(stderr, "timeGetTime()\n"); + struct timeval tv1; + int secs, usecs; - return 0; + if (tv0.tv_sec == 0) { + gettimeofday(&tv0, NULL); + + return 0; + } + + gettimeofday(&tv1, NULL); + + secs = tv1.tv_sec - tv0.tv_sec; + usecs = tv1.tv_usec - tv0.tv_usec; + if (usecs < 0) { + usecs += 1000000; + secs--; + } + +printf("Ticks = %u\n", secs * 1000 + (usecs / 1000)); + + return secs * 1000 + (usecs / 1000); } -int GetTickCount() +unsigned int GetTickCount() { - fprintf(stderr, "GetTickCount()\n"); - - return 0; + return timeGetTime(); } -- cgit v1.3