This is a simple alternative uptime CLI tool written in Rust.
upt
does not try to be equivalent to the uptime
binary.
Rather it defaults to printing duration in a human-readable format.
Optionally the time / duration can be printed in ISO 8601 format by specifying the --iso
flag.
Additionally, it's possible to watch the duration by adding the --watch
flag.
A special feature is the ability to set the displayed uptime to zero by using the --reset
flag.
This does not influence the system uptime counter.
This feature persists the timestamp from the moment the reset is performed.
When evaluating the start time it chooses between the system uptime and the persisted timestamp to choose the latest instant.
After a reset, it's possible to force the use of the system uptime by using the --system
flag.
All this is accomplished by relying on the fantastic Rust ecosystem and using preexisting crates as much as possible
so as not to reinvent the wheel (e.g. using clap
for CLI argument parsing and chrono
for time manipulation).
Finally, a robust CI workflow is used to build release binaries for several platforms and architectures. These release artifacts include SBOM and SLSA attestation.