--- ray/src/util/ranimove.c 2010/11/03 05:05:21 3.14 +++ ray/src/util/ranimove.c 2016/03/06 01:13:18 3.16 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: ranimove.c,v 3.14 2010/11/03 05:05:21 greg Exp $"; +static const char RCSid[] = "$Id: ranimove.c,v 3.16 2016/03/06 01:13:18 schorsch Exp $"; #endif /* * Radiance object animation program @@ -12,7 +12,7 @@ static const char RCSid[] = "$Id: ranimove.c,v 3.14 20 #include "copyright.h" #include -#ifdef _WIN32 +#if defined(_WIN32) || defined(_WIN64) #include /* struct timeval. XXX find a replacement? */ #else #include @@ -20,6 +20,7 @@ static const char RCSid[] = "$Id: ranimove.c,v 3.14 20 #include #include +#include "platform.h" #include "paths.h" #include "ranimove.h" @@ -851,6 +852,44 @@ obj_prio( /* return priority for object */ return(obj_move[moi].cprio); } + +#if defined(_WIN32) || defined(_WIN64) + /* replacement function for Windoze */ +static int +gettimeofday(struct timeval *tp, void *dummy) +{ + FILETIME ft; + LARGE_INTEGER li; + __int64 t; + + SYSTEMTIME st; + FILETIME ft2; + LARGE_INTEGER li2; + __int64 t2; + + st.wYear = 1970; + st.wHour = 0; + st.wMinute = 0; + st.wSecond = 0; + st.wMilliseconds = 1; + + SystemTimeToFileTime(&st, &ft2); + li2.LowPart = ft2.dwLowDateTime; + li2.HighPart = ft2.dwHighDateTime; + t2 = li2.QuadPart; + + GetSystemTimeAsFileTime(&ft); + li.LowPart = ft.dwLowDateTime; + li.HighPart = ft.dwHighDateTime; + t = li.QuadPart; + t -= t2; // From 1970 + t /= 10; // In microseconds + tp->tv_sec = (long)(t / 1000000); + tp->tv_usec = (long)(t % 1000000); + return 0; +} + +#endif extern double getTime(void) /* get current time (CPU or real) */