Skip to content

timeval: use CLOCK_MONOTONIC_RAW if available - #11291

Closed
bagder wants to merge 2 commits into
masterfrom
bagder/monotonic-raw
Closed

bagder wants to merge 2 commits into
masterfrom
bagder/monotonic-raw

Conversation

@bagder

@bagder bagder commented Jun 9, 2023

Copy link
Copy Markdown
Member

Reported-by: Harry Sintonen
Ref: #11288

Reported-by: Harry Sintonen
Ref: #11288

@dfandrich dfandrich left a comment

Copy link
Copy Markdown
Contributor

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

bagder commented Jun 9, 2023

Copy link
Copy Markdown
Member Author

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

@bagder

bagder commented Jun 10, 2023

Copy link
Copy Markdown
Member Author

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

dfandrich commented Jun 10, 2023 via email

Copy link
Copy Markdown
Contributor

@bagder

bagder commented Jun 12, 2023

Copy link
Copy Markdown
Member Author

@dfandrich what do you think of this approach?

@dfandrich dfandrich left a comment

Copy link
Copy Markdown
Contributor

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