Why is tokio::time::sleep less accurate in its sleep duration compared to std::time::sleep? #5996
Unanswered
phil-skillwon
asked this question in
Q&A
Replies: 1 comment 5 replies
-
The Tokio timer only has a resolution of one millisecond, so it may be incorrect by up to one millisecond. If you need a more precise timer, then use one of these options:
|
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Why is tokio::time::sleep less accurate in its sleep duration compared to std::time::sleep?
For instance, if I set it to sleep for 100 milliseconds, using tokio::time::sleep.await might actually sleep for 101 milliseconds, while using std::time::sleep genuinely sleeps for 100 milliseconds. Is there any way to make tokio::time::sleep more precise?
Beta Was this translation helpful? Give feedback.
All reactions