diff options
| author | Theo Buehler <tb@openbsd.org> | 2026-09-07 17:47:44 +0200 |
|---|---|---|
| committer | Theo Buehler <tb@openbsd.org> | 2026-09-07 17:47:44 +0200 |
| commit | 737f1f394ad27bbd3ed2255ce895a47d58c6d2e8 (patch) | |
| tree | d39ffc32cebbdfaecdbec1e9c5c46752c9b109a8 | |
| parent | d63a1f105815c3fe4ffd954443541bff5259cedf (diff) | |
| parent | e9d7606869bd17f22bb7430481a661bab41194a2 (diff) | |
| download | portable-737f1f394ad27bbd3ed2255ce895a47d58c6d2e8.tar.gz portable-737f1f394ad27bbd3ed2255ce895a47d58c6d2e8.tar.bz2 portable-737f1f394ad27bbd3ed2255ce895a47d58c6d2e8.zip | |
Land #1368 - use winsock's timeval in sys/time.h shim
| -rw-r--r-- | crypto/compat/posix_win.c | 2 | ||||
| -rw-r--r-- | include/compat/sys/time.h | 11 |
2 files changed, 6 insertions, 7 deletions
diff --git a/crypto/compat/posix_win.c b/crypto/compat/posix_win.c index 60b2896..14b79f5 100644 --- a/crypto/compat/posix_win.c +++ b/crypto/compat/posix_win.c | |||
| @@ -303,7 +303,7 @@ int gettimeofday(struct timeval *tp, void *tzp) | |||
| 303 | time = ((uint64_t)file_time.dwLowDateTime); | 303 | time = ((uint64_t)file_time.dwLowDateTime); |
| 304 | time += ((uint64_t)file_time.dwHighDateTime) << 32; | 304 | time += ((uint64_t)file_time.dwHighDateTime) << 32; |
| 305 | 305 | ||
| 306 | tp->tv_sec = (long long)((time - EPOCH) / 10000000L); | 306 | tp->tv_sec = (long)((time - EPOCH) / 10000000L); |
| 307 | tp->tv_usec = (long)(system_time.wMilliseconds * 1000); | 307 | tp->tv_usec = (long)(system_time.wMilliseconds * 1000); |
| 308 | return 0; | 308 | return 0; |
| 309 | } | 309 | } |
diff --git a/include/compat/sys/time.h b/include/compat/sys/time.h index 2448969..0388333 100644 --- a/include/compat/sys/time.h +++ b/include/compat/sys/time.h | |||
| @@ -7,16 +7,15 @@ | |||
| 7 | #define LIBCRYPTOCOMPAT_SYS_TIME_H | 7 | #define LIBCRYPTOCOMPAT_SYS_TIME_H |
| 8 | 8 | ||
| 9 | #ifdef _MSC_VER | 9 | #ifdef _MSC_VER |
| 10 | /* | ||
| 11 | * Use the winsock struct timeval: it is what <openssl/dtls1.h> gives | ||
| 12 | * callers of DTLSv1_get_timeout() and the dgram BIO ctrls, so libssl | ||
| 13 | * must be built against the same layout. | ||
| 14 | */ | ||
| 10 | #include <winsock2.h> | 15 | #include <winsock2.h> |
| 11 | 16 | ||
| 12 | #define timeval libressl_timeval | ||
| 13 | #define gettimeofday libressl_gettimeofday | 17 | #define gettimeofday libressl_gettimeofday |
| 14 | 18 | ||
| 15 | struct timeval { | ||
| 16 | long long tv_sec; | ||
| 17 | long tv_usec; | ||
| 18 | }; | ||
| 19 | |||
| 20 | int gettimeofday(struct timeval *tp, void *tzp); | 19 | int gettimeofday(struct timeval *tp, void *tzp); |
| 21 | #else | 20 | #else |
| 22 | #include_next <sys/time.h> | 21 | #include_next <sys/time.h> |
