Skip to content

Switch Instant to use CLOCK_BOOTTIME #87907

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/std/src/sys/unix/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ mod inner {

impl Instant {
pub fn now() -> Instant {
Instant { t: now(libc::CLOCK_MONOTONIC) }
Instant { t: now(libc::CLOCK_BOOTTIME) }
Copy link
Contributor

Choose a reason for hiding this comment

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

CLOCK_BOOTTIME isn't supported on Linux <= 2.6.39, but Rust supports Linux >= 2.6.32. This should check if -EINVAL is returned and fall back to CLOCK_MONOTONIC if so.

}

pub const fn zero() -> Instant {
Expand Down