+/GENN
genetically evolving neural networks
git clone https://git.julia.blue/+/GENN
544bdde
v0.1
1#ifdef _WIN32 2#include <Windows.h> 3#else 4#include <sys/time.h> 5#include <ctime> 6#endif 7 8/* Remove if already defined */ 9typedef long long int64 ;typedef unsigned long long uint64 ; 10 11/* Returns the amount of milliseconds elapsed since the UNIX epoch. Works on both 12* windows and linux. */ 13 14uint64 GetTimeMs64 (){ 15#ifdef _WIN32 16/* Windows */ 17FILETIME ft ; 18LARGE_INTEGER li ; 19 20/* Get the amount of 100 nano seconds intervals elapsed since January 1, 1601 (UTC) and copy it 21* to a LARGE_INTEGER structure. */ 22GetSystemTimeAsFileTime (& ft ); 23li .LowPart = ft .dwLowDateTime ; 24li .HighPart = ft .dwHighDateTime ; 25 26uint64 ret = li .QuadPart ; 27ret -= 116444736000000000LL ;/* Convert from file time to UNIX epoch time. */ 28ret /=10000 ;/* From 100 nano seconds (10^-7) to 1 millisecond (10^-3) intervals */ 29 30return ret ; 31#else 32/* Linux */ 33struct timeval tv ; 34 35gettimeofday (& tv ,NULL ); 36 37uint64 ret = tv .tv_usec ; 38/* Convert from micro seconds (10^-6) to milliseconds (10^-3) */ 39ret /=1000 ; 40 41/* Adds the seconds (10^0) after converting them to milliseconds (10^-3) */ 42ret += (tv .tv_sec * 1000 ); 43 44return ret ; 45#endif 46}