Open wavexx opened 3 years ago
I forgot about this during our email conversation, but the main xidlehook client does not actually use this code path. It uses tokio, which uses rust's Instant, a monotonic clock.
I would have to work around this to use CLOCK_BOOTTIME, which I'm not sure is trivial. I think your best bet is to bump this issue.
Sorry for the letdown.
That said, how are you un-suspending your system without also becoming idle? Some kind of Wake on LAN?
Ahh, the joys of cross platform wrappers...
When sleeping between timers, the current code uses nanosleep, which uses CLOCK_MONOTONIC as a time source.
CLOCK_MONOTONIC doesn't advance when the system is suspended, which prevents xidlelock to trigger correctly right after the system has woken up from an extended sleep.
xidlelock should probably use clock_nanosleep with CLOCK_BOOTTIME as a time source, which correctly counts suspended time.