1 #if (defined _WIN32_) || (defined _MSC_VER) 8 #ifndef CUSTOM_WINDOWS_TIME_H_ 9 #define CUSTOM_WINDOWS_TIME_H_ 11 #define _WINSOCKAPI_ // stops windows.h including winsock.h; timeval redefine 16 typedef struct timeval {
21 int gettimeofday(
struct timeval * tp,
struct timezone * tzp)
28 SYSTEMTIME system_time;
32 GetSystemTime( &system_time );
33 SystemTimeToFileTime( &system_time, &file_time );
34 time = ((
uint64_t)file_time.dwLowDateTime ) ;
35 time += ((
uint64_t)file_time.dwHighDateTime) << 32;
37 tp->tv_sec = (long) ((time - EPOCH) / 10000000L);
38 tp->tv_usec = (long) (system_time.wMilliseconds * 1000);
43 #endif // CUSTOM_WINDOWS_TIME_H_ unsigned __int64 uint64_t