ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/ranimove.c
(Generate patch)

Comparing ray/src/util/ranimove.c (file contents):
Revision 3.14 by greg, Wed Nov 3 05:05:21 2010 UTC vs.
Revision 3.16 by schorsch, Sun Mar 6 01:13:18 2016 UTC

# Line 12 | Line 12 | static const char RCSid[] = "$Id$";
12   #include "copyright.h"
13  
14   #include <time.h>
15 < #ifdef _WIN32
15 > #if defined(_WIN32) || defined(_WIN64)
16    #include <winsock.h> /* struct timeval. XXX find a replacement? */
17   #else
18    #include <sys/time.h>
# Line 20 | Line 20 | static const char RCSid[] = "$Id$";
20   #include <ctype.h>
21   #include <string.h>
22  
23 + #include "platform.h"
24   #include "paths.h"
25   #include "ranimove.h"
26  
# Line 851 | Line 852 | obj_prio(                      /* return priority for object */
852          return(obj_move[moi].cprio);
853   }
854  
855 +
856 + #if defined(_WIN32) || defined(_WIN64)
857 +                                /* replacement function for Windoze */
858 + static int
859 + gettimeofday(struct timeval *tp, void *dummy)
860 + {
861 +    FILETIME        ft;
862 +    LARGE_INTEGER   li;
863 +    __int64         t;
864 +
865 +        SYSTEMTIME              st;
866 +        FILETIME                ft2;
867 +        LARGE_INTEGER   li2;
868 +        __int64                 t2;
869 +
870 +        st.wYear = 1970;
871 +        st.wHour = 0;
872 +        st.wMinute = 0;
873 +        st.wSecond = 0;
874 +        st.wMilliseconds = 1;
875 +
876 +        SystemTimeToFileTime(&st, &ft2);
877 +        li2.LowPart = ft2.dwLowDateTime;
878 +        li2.HighPart = ft2.dwHighDateTime;
879 +        t2 = li2.QuadPart;
880 +
881 +    GetSystemTimeAsFileTime(&ft);
882 +    li.LowPart  = ft.dwLowDateTime;
883 +    li.HighPart = ft.dwHighDateTime;
884 +    t  = li.QuadPart;      
885 +    t -= t2; // From 1970
886 +    t /= 10; // In microseconds
887 +    tp->tv_sec  = (long)(t / 1000000);
888 +    tp->tv_usec = (long)(t % 1000000);
889 +    return 0;
890 + }
891 +
892 + #endif
893  
894   extern double
895   getTime(void)                   /* get current time (CPU or real) */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines