Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/openssl/compat/poll_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@ poll(struct pollfd *pfds, nfds_t nfds, int timeout_ms)
timespent_ms = 0;
wait_rc = WAIT_FAILED;

looptime_ms = (timeout_ms > 100 || timeout_ms == -1) ? 100 : timeout_ms;
if (timeout_ms < 0)
timeout_ms = INFINITE;
looptime_ms = timeout_ms > 100 ? 100 : timeout_ms;

do {
struct timeval tv;
TIMEVAL tv;
tv.tv_sec = 0;
tv.tv_usec = looptime_ms * 1000;
int handle_signaled = 0;
Expand Down
2 changes: 1 addition & 1 deletion crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ endif()

if(WIN32)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/posix_win.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} gettimeofday)
set(EXTRA_EXPORT ${EXTRA_EXPORT} gettimeofday=libressl_gettimeofday)
set(EXTRA_EXPORT ${EXTRA_EXPORT} getuid)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_perror)
set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_fopen)
Expand Down
4 changes: 3 additions & 1 deletion crypto/compat/posix_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#define NO_REDEF_POSIX_FUNCTIONS

#include <sys/time.h>

#include <windows.h>
#include <ws2tcpip.h>

Expand Down Expand Up @@ -303,7 +305,7 @@ int gettimeofday(struct timeval * tp, struct timezone * tzp)
time = ((uint64_t)file_time.dwLowDateTime);
time += ((uint64_t)file_time.dwHighDateTime) << 32;

tp->tv_sec = (long)((time - EPOCH) / 10000000L);
tp->tv_sec = (long long)((time - EPOCH) / 10000000L);
tp->tv_usec = (long)(system_time.wMilliseconds * 1000);
return 0;
}
Expand Down
9 changes: 9 additions & 0 deletions include/compat/sys/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@

#ifdef _MSC_VER
#include <winsock2.h>

#define timeval libressl_timeval
#define gettimeofday libressl_gettimeofday

struct timeval {
long long tv_sec;
long tv_usec;
};

int gettimeofday(struct timeval *tp, void *tzp);
#else
#include_next <sys/time.h>
Expand Down