X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmisc.cpp;h=281d8595a7cca6dd227fe6c0f83b1cb7610beb04;hp=1c16726e809bf11fd70887f0bd4cc8f8f0c82c40;hb=991ab2bea8448bcd01586db8439ab749e96da7ff;hpb=ef600437250a12aad8cb9ba95716528c40902a9f diff --git a/src/misc.cpp b/src/misc.cpp index 1c16726e..281d8595 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -29,11 +29,32 @@ # include #else +/* + (c) Copyright 1992 Eric Backus + This software may be used freely so long as this copyright notice is + left intact. There is no warrantee on this software. +*/ # include # include # include "dos.h" -int gettimeofday(struct timeval * tp, struct timezone * tzp); +static int gettimeofday(struct timeval* tp, struct timezone*) +{ + SYSTEMTIME systime; + + if (tp) + { + struct tm tmrec; + time_t theTime = time(NULL); + + tmrec = *localtime(&theTime); + tp->tv_sec = mktime(&tmrec); + GetLocalTime(&systime); /* system time */ + + tp->tv_usec = systime.wMilliseconds * 1000; + } + return 0; +} #endif