add initial CMake and Visual Studio build support
This moves the compatibility include files from include to include/compat so we can use the awful MS C compiler <../include/> trick to emulate the GNU #include_next extension. This also removes a few old compat files we do not need anymore.
This commit is contained in:
@@ -166,3 +166,27 @@ posix_setsockopt(int sockfd, int level, int optname,
|
||||
int rc = setsockopt(sockfd, level, optname, (char *)optval, optlen);
|
||||
return rc == 0 ? 0 : wsa_errno(WSAGetLastError());
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
int gettimeofday(struct timeval * tp, struct timezone * tzp)
|
||||
{
|
||||
/*
|
||||
* Note: some broken versions only have 8 trailing zero's, the correct
|
||||
* epoch has 9 trailing zero's
|
||||
*/
|
||||
static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL);
|
||||
|
||||
SYSTEMTIME system_time;
|
||||
FILETIME file_time;
|
||||
uint64_t time;
|
||||
|
||||
GetSystemTime(&system_time);
|
||||
SystemTimeToFileTime(&system_time, &file_time);
|
||||
time = ((uint64_t)file_time.dwLowDateTime);
|
||||
time += ((uint64_t)file_time.dwHighDateTime) << 32;
|
||||
|
||||
tp->tv_sec = (long)((time - EPOCH) / 10000000L);
|
||||
tp->tv_usec = (long)(system_time.wMilliseconds * 1000);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user