diff options
author | Pauli <pauli@openssl.org> | 2022-08-29 14:53:45 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-09-13 21:13:35 +1000 |
commit | 5d1bb4fc47582b06dd224a788bdfaaced60e72a0 (patch) | |
tree | 114804c929bb4ecf642752bb186aa42cfe6ebc41 /include/internal/e_os.h | |
parent | 02d0f87a8ba143eaeaee3334a2f63543b10148a9 (diff) |
libcrypto: remove reliance on struct timeval
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19082)
Diffstat (limited to 'include/internal/e_os.h')
-rw-r--r-- | include/internal/e_os.h | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/include/internal/e_os.h b/include/internal/e_os.h index 9e2f14072f..0e52036434 100644 --- a/include/internal/e_os.h +++ b/include/internal/e_os.h @@ -322,15 +322,10 @@ static ossl_inline void ossl_sleep(unsigned long millis) /* Fallback to a busy wait */ static ossl_inline void ossl_sleep(unsigned long millis) { - struct timeval start, now; - unsigned long elapsedms; - - gettimeofday(&start, NULL); - do { - gettimeofday(&now, NULL); - elapsedms = (((now.tv_sec - start.tv_sec) * 1000000) - + now.tv_usec - start.tv_usec) / 1000; - } while (elapsedms < millis); + const OSSL_TIME finish = ossl_time_add(ossl_time_now(), ossl_ms2time(millis)); + + while (ossl_time_compare(ossl_time_now(), finish) < 0) + /* busy wait */ ; } #endif /* defined OPENSSL_SYS_UNIX */ |