tokio::time::timeout not expiring precisely (Android) #4388
Replies: 1 comment 1 reply
-
When the device goes to sleep, a Tokio timer does not count any time that passed while it was asleep. You can read more about possibly changing that in #3185, but we are currently waiting for changes in std for that. To get a timer that will properly count time that passes during sleep, you will need to use a timerfd hooked up to the Be aware that even when using timerfd, the timer will not wake the device up. If the timer expires while the device is asleep, then it will fire immediately next time the device wakes up. I don't know how to actually wake up the device when a timer expires, unfortunately. |
Beta Was this translation helpful? Give feedback.
-
Hi all,
As mentioned in the title, I observe that the timeout is not expiring precisely in Android devices, understand that this might happen due to Android in sleep mode, and someone suggested wake-lock in this post (https://stackoverflow.com/questions/47472741/timer-not-expiring-precisely-during-sleep-state-in-android).
May I have any suggestion if tokio have similar stuff or how should I go about to overcome the "sleep" as I really need precise timer. TIA
Beta Was this translation helpful? Give feedback.
All reactions