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

timeval: use CLOCK_MONOTONIC_RAW if available #11291

Closed
wants to merge 2 commits into from

Conversation

bagder
Copy link
Member

@bagder bagder commented Jun 9, 2023

Reported-by: Harry Sintonen
Ref: #11288

Reported-by: Harry Sintonen
Ref: #11288
Copy link
Contributor

@dfandrich dfandrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically, CLOCK_MONOTONIC_RAW could exist and be found by autoconf but the system call could fail, while CLOCK_MONOTONIC would succeed. On Linux, this would happen if run on really old kernels (like 2.6.27) so it's probably not worth worrying about there, but what other systems support CLOCK_MONOTONIC_RAW? If there are others, or there could be others in the future, it might be worth calling both, with CLOCK_MONOTONIC only if CLOCK_MONOTONIC_RAW fails.

@bagder
Copy link
Member Author

bagder commented Jun 9, 2023

macOS supports CLOCK_MONOTONIC_RAW. I don't know since which version...

@bagder
Copy link
Member Author

bagder commented Jun 10, 2023

Theoretically, CLOCK_MONOTONIC_RAW could exist and be found by autoconf but the system call could fail, while CLOCK_MONOTONIC would succeed

What weirdness would cause that to happen?

@dfandrich
Copy link
Contributor

dfandrich commented Jun 10, 2023 via email

@bagder
Copy link
Member Author

bagder commented Jun 12, 2023

@dfandrich what do you think of this approach?

Copy link
Contributor

@dfandrich dfandrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. This should work fine now even on old (possibly ancient?) systems.

@bagder bagder closed this in c92b722 Jun 12, 2023
@bagder bagder deleted the bagder/monotonic-raw branch June 12, 2023 22:03
bch pushed a commit to bch/curl that referenced this pull request Jul 19, 2023
ptitSeb pushed a commit to wasix-org/curl that referenced this pull request Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants