On Thu Feb 20 22:06:55 2025 +0000, Paul Gofman wrote:
If not, that it is suspicious that additional 0.5ms waited has such an effect. That can probably be checked on Windows by making a background program which does timeBeginPeriod(16) periodically (so it sleeps much longer), does it have the same effect on Windows? And does the game actually sets the timer resolution?
Alertable sleeps can last an extra 1ms longer than desired, with an average of 0.5ms, due to the timeout's ceiling acting on a `monotonic_time` or `current_time` variable that is being updated on each server call.
This doesn't happen on Windows. I'll attach a test program here to showcase the issue, notice the aliasing for the error values that happens on Wine.
[timeout-test-sleep.c](/uploads/83edfb9bcd0249646c00eb24d76091ff/timeout-test-sleep.c)