The sleep functions
select() are not accurate on macOS. The actual sleep times are much longer than expected. For example,
nanosleep(100000) is expected to sleep for 100ms, but the actual sleep time is 175ms, The percentage of deviation is 75%, which I think the reasonable value is 20%.
select() have the same issue.
This issue is only happened on macOS . It’s all ok on linux .
My test code is here .
In addition, all sleep functions work fine on my own Macbook.