--- wrapper_3.1.1_src/src/c/wrapper.c Fri Jul 16 10:29:10 2004 +++ wrapper_3.1.1_src_modified/src/c/wrapper.c Fri Sep 16 14:55:23 2005 @@ -312,7 +312,13 @@ #include #include #include + +#ifdef MACOSX +#include +#else #include +#endif + #include #include "wrapperinfo.h" #include "wrapper.h" @@ -760,16 +766,28 @@ int len; int pos; int err; + + #ifdef MACOSX + struct timeval timeBuffer; + #else struct timeb timeBuffer; + #endif + long startTime; int startTimeMillis; long now; int nowMillis; long durr; +#ifdef MACOSX + gettimeofday(&timeBuffer, NULL); + startTime = now = timeBuffer.tv_sec; + startTimeMillis = nowMillis = timeBuffer.tv_usec / 1000; +#else ftime( &timeBuffer ); startTime = now = timeBuffer.time; startTimeMillis = nowMillis = timeBuffer.millitm; +#endif /* log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG, "now=%ld, nowMillis=%d", now, nowMillis); @@ -900,9 +918,15 @@ } /* Get the time again */ +#ifdef MACOSX + gettimeofday(&timeBuffer, NULL); + now = timeBuffer.tv_sec; + nowMillis = timeBuffer.tv_usec / 1000; +#else ftime( &timeBuffer ); now = timeBuffer.time; nowMillis = timeBuffer.millitm; +#endif } /* log_printf(WRAPPER_SOURCE_WRAPPER, LEVEL_DEBUG, "done durr=%ld", durr); @@ -2250,10 +2274,15 @@ * Calculates a tick count using the system time. */ DWORD wrapperGetSystemTicks() { +#ifdef MACOSX + struct timeval timeBuffer; + gettimeofday(&timeBuffer, NULL); + return (timeBuffer.tv_sec * 1000 + timeBuffer.tv_usec/1000) / WRAPPER_TICK_MS; +#else struct timeb timeBuffer; - ftime( &timeBuffer ); return (timeBuffer.time * 1000 + timeBuffer.millitm) / WRAPPER_TICK_MS; +#endif } /**