diff --git a/src/port.c b/src/port.c index a0a3ca8..79f5cc6 100644 --- a/src/port.c +++ b/src/port.c @@ -310,17 +310,7 @@ const char * ortp_strerror(DWORD value) { ); return (const char *)msgBuf; } - -int -gettimeofday (struct timeval *tv, void *tz) -{ - DWORD timemillis = GetTickCount(); - tv->tv_sec = timemillis/1000; - tv->tv_usec = (timemillis - (tv->tv_sec*1000)) * 1000; - return 0; -} - -#else +#endif int gettimeofday (struct timeval *tv, void* tz) { @@ -330,14 +320,16 @@ int gettimeofday (struct timeval *tv, void* tz) FILETIME fileTime; } now; +#if defined(_WIN32_WCE) && _WIN32_WCE < 0x600 + GetCurrentFT (&now.fileTime); +#else GetSystemTimeAsFileTime (&now.fileTime); +#endif tv->tv_usec = (long) ((now.ns100 / 10LL) % 1000000LL); tv->tv_sec = (long) ((now.ns100 - 116444736000000000LL) / 10000000LL); return (0); } -#endif - const char *getWinSocketError(int error) { static char buf[80];