From 7a6e1bcf6c17a1c98277ccbfff7d2de1cc32f4b8 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 29 Apr 2025 21:56:30 +0200 Subject: [PATCH] readd old nanosleep since it appeared to work just fine in testing actually forgor to remove it from the lol --- src/sdl/i_system.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index f585fc44b..b622c4c45 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1790,7 +1790,16 @@ void I_Sleep(UINT32 ms) void I_SleepDuration(precise_t duration) { -#if defined (MIN_SLEEP_DURATION_MS) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__HAIKU__) + UINT64 precision = I_GetPrecisePrecision(); + struct timespec ts = { + .tv_sec = duration / precision, + .tv_nsec = duration * 1000000000 / precision % 1000000000, + }; + int status; + do status = clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts); + while (status == EINTR); +#elif defined (MIN_SLEEP_DURATION_MS) UINT64 precision = I_GetPrecisePrecision(); INT32 sleepvalue = cv_sleep.value; UINT64 delaygranularity;