Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CLOCK_BOOTTIME source when sleeping #64

Open
wavexx opened this issue Mar 16, 2021 · 2 comments
Open

Use CLOCK_BOOTTIME source when sleeping #64

wavexx opened this issue Mar 16, 2021 · 2 comments

Comments

@wavexx
Copy link

wavexx commented Mar 16, 2021

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.

@jD91mZM2
Copy link
Owner

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?

@wavexx
Copy link
Author

wavexx commented Mar 21, 2021

Ahh, the joys of cross platform wrappers...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants