Skip to content

uptime: uucore/get_uptime should return a Duration #7851

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

Open
drinkcat opened this issue Apr 28, 2025 · 1 comment
Open

uptime: uucore/get_uptime should return a Duration #7851

drinkcat opened this issue Apr 28, 2025 · 1 comment

Comments

@drinkcat
Copy link
Contributor

uucore's get_uptime function:

  • Returns a signed integer value (but the uptime can't be a negative value?)
  • Ignores fractional parts of a second even though the Linux kernel provides that in /proc/uptime.

Possibly depending on the fractional timestamp value at boot time, the second point can cause a 1 second offset between GNU coreutils and uutils:

$ uptime --since
2025-04-23 18:26:36
$ cargo run -p uu_uptime -- --since
2025-04-23 18:26:37

I believe we should change the function signature to return a Duration.

Not sure how much we care about semver in uucore, we would need to modify procps/uu_top as well: see #7289.

@sylvestre
Copy link
Contributor

it is fine if we need to update procps, it is WIP

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

No branches or pull requests

3 participants