mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-23 04:11:17 +00:00
Slight optimization
This commit is contained in:
parent
d20552c49d
commit
1da55066d4
1 changed files with 3 additions and 2 deletions
|
@ -2310,9 +2310,10 @@ 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 / precision > 1)
|
||||
precise_t slack = (precision / 10000); // 0.1 ms slack
|
||||
if (duration > slack)
|
||||
{
|
||||
duration -= (precision / 10000); // 0.1 ms slack
|
||||
duration -= slack;
|
||||
struct timespec ts = {
|
||||
.tv_sec = duration / precision,
|
||||
.tv_nsec = duration * 1000000000 / precision % 1000000000,
|
||||
|
|
Loading…
Reference in a new issue