diff options
author | Brent Cook <busterb@gmail.com> | 2014-07-10 22:06:10 -0500 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2015-07-21 12:08:18 -0500 |
commit | 5d8a1cf7155130bd8101090d7e1d0c2f90d9b123 (patch) | |
tree | 286f7d12e3647f94bd1e6e8e180a4bf6215a0740 /crypto/compat | |
parent | 7a4a37cf596697ae96eeb1c555989e6d1a443187 (diff) | |
download | portable-5d8a1cf7155130bd8101090d7e1d0c2f90d9b123.tar.gz portable-5d8a1cf7155130bd8101090d7e1d0c2f90d9b123.tar.bz2 portable-5d8a1cf7155130bd8101090d7e1d0c2f90d9b123.zip |
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.
Diffstat (limited to 'crypto/compat')
-rw-r--r-- | crypto/compat/posix_win.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crypto/compat/posix_win.c b/crypto/compat/posix_win.c index 855406b..f8a46ab 100644 --- a/crypto/compat/posix_win.c +++ b/crypto/compat/posix_win.c | |||
@@ -166,3 +166,27 @@ posix_setsockopt(int sockfd, int level, int optname, | |||
166 | int rc = setsockopt(sockfd, level, optname, (char *)optval, optlen); | 166 | int rc = setsockopt(sockfd, level, optname, (char *)optval, optlen); |
167 | return rc == 0 ? 0 : wsa_errno(WSAGetLastError()); | 167 | return rc == 0 ? 0 : wsa_errno(WSAGetLastError()); |
168 | } | 168 | } |
169 | |||
170 | #ifdef _MSC_VER | ||
171 | int gettimeofday(struct timeval * tp, struct timezone * tzp) | ||
172 | { | ||
173 | /* | ||
174 | * Note: some broken versions only have 8 trailing zero's, the correct | ||
175 | * epoch has 9 trailing zero's | ||
176 | */ | ||
177 | static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL); | ||
178 | |||
179 | SYSTEMTIME system_time; | ||
180 | FILETIME file_time; | ||
181 | uint64_t time; | ||
182 | |||
183 | GetSystemTime(&system_time); | ||
184 | SystemTimeToFileTime(&system_time, &file_time); | ||
185 | time = ((uint64_t)file_time.dwLowDateTime); | ||
186 | time += ((uint64_t)file_time.dwHighDateTime) << 32; | ||
187 | |||
188 | tp->tv_sec = (long)((time - EPOCH) / 10000000L); | ||
189 | tp->tv_usec = (long)(system_time.wMilliseconds * 1000); | ||
190 | return 0; | ||
191 | } | ||
192 | #endif | ||