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> |
20 |
|
#include <ctype.h> |
21 |
|
#include <string.h> |
22 |
|
|
23 |
+ |
#include "platform.h" |
24 |
|
#include "paths.h" |
25 |
|
#include "ranimove.h" |
26 |
|
|
350 |
|
av[ac=0] = NULL; |
351 |
|
/* load options from file, first */ |
352 |
|
if (optf != NULL && *optf) { |
353 |
< |
ac = wordfile(av, optf); |
353 |
> |
ac = wordfile(av, 1024, optf); |
354 |
|
if (ac < 0) { |
355 |
|
sprintf(errmsg, "cannot load options file \"%s\"", |
356 |
|
optf); |
359 |
|
} |
360 |
|
/* then from options string */ |
361 |
|
if (qval != NULL && qval[0] == '-') |
362 |
< |
ac += wordstring(av+ac, qval); |
362 |
> |
ac += wordstring(av+ac, 1024-ac, qval); |
363 |
|
|
364 |
|
/* restore default parameters */ |
365 |
|
ray_restore(NULL); |
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) */ |