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

Add wrappers for some time-related syscalls #1299

Closed
maxbla opened this issue Sep 24, 2020 · 5 comments · Fixed by #2277
Closed

Add wrappers for some time-related syscalls #1299

maxbla opened this issue Sep 24, 2020 · 5 comments · Fixed by #2277

Comments

@maxbla
Copy link
Contributor

maxbla commented Sep 24, 2020

gettimeofday, clock_gettime, clock_settime, clock_getres, nanosleep and clock_nanosleep seem to be supported by various *nixes (at least Linux and FreeBSD), but bindings are not included in this crate.

I'd be happy to open a PR adding these bindings.

@asomers
Copy link
Member

asomers commented Oct 3, 2020

Check again. #1281 just added some of those.

@maxbla
Copy link
Contributor Author

maxbla commented Oct 3, 2020

Darn. I must have searched issues and not pull requests. Regardless, some are still not implemented (the original issue has been edited).

@asomers
Copy link
Member

asomers commented Oct 10, 2020

Why would you ever use gettimeofday in new code, instead of clock_gettime? And why would you ever need nanosleep instead of thread::sleep?

@maxbla
Copy link
Contributor Author

maxbla commented Oct 10, 2020

My use case is rather niche - I'm instrumenting syscalls, which is quite possibly the only reason to use the first two functions in new code. clock_nanosleep could use a clock other than CLOCK_MONATONIC, which is what std frequently uses (std uses plain nanosleep for thread::sleep).

Do you think it would be worthwhile to at least implement clock_nanosleep?

@asomers
Copy link
Member

asomers commented Oct 10, 2020

Do you think it would be worthwhile to at least implement clock_nanosleep?

Yep.

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

Successfully merging a pull request may close this issue.

2 participants