uptimer

A multiplatform library to get the uptime of the current process

1 unstable release

0.2.1 Jul 28, 2024

MIT/Apache

5KB
51 lines

uptimer

A multiplatform library to get the uptime of the current process.

  • Windows
  • Linux
  • macOS

Example

uptimer = { git = "https://github.com/nerixyz/uptimer", tag = "v0.2.0" }
use std::thread::sleep;
use std::time::Duration;

fn main() {
    sleep(Duration::from_secs(2));
    println!("{:?}", uptimer::get());
}

lib.rs:

This library returns the uptime of the current process on windows and unix-like systems.

Example

use std::thread::sleep;
use std::time::Duration;

sleep(Duration::from_secs(2));
assert!(uptimer::get().unwrap() >= Duration::from_secs(2))

Dependencies

~0–35MB
~526K SLoC