Alug committed 2025-01-05 17:41:02 +01:00
1 parent d9b04cd7d8
commit 849cfbfbfa
1 file changed
+2 -2
+2 -2
View File
@@ -2133,9 +2133,9 @@ void I_SleepDuration(precise_t duration)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__HAIKU__)
UINT64 precision = I_GetPrecisePrecision();
precise_t dest = I_GetPreciseTime() + duration;
if (duration > 100000)
if (duration * 100000 / precision > 1)
{
duration -= 100000; // 0.1 ms slack
duration -= (precision / 10000); // 0.1 ms slack
struct timespec ts = {
.tv_sec = duration / precision,
.tv_nsec = duration * 1000000000 / precision % 1000000000,