Adjust slack based on precision
https://git.do.srb2.org/STJr/SRB2/-/commit/d20552c49d9fd6a2075ebd7d46b0b133c69f1dbe?merge_request_iid=2583
This commit is contained in:
1 parent
d9b04cd7d8
commit
849cfbfbfa
1 file changed
+2
-2
+2
-2
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user