Giter Site home page Giter Site logo

uptime-rs's Introduction

Multi-platform uptime library for Rust

CI Status crates.io release MIT License

Example

extern crate uptime_lib;

fn main() {
    match uptime_lib::get() {
        Ok(uptime) => {
            println!("uptime: {} seconds", uptime.as_secs_f64());
        }
        Err(err) => {
            eprintln!("uptime: {}", err);
            std::process::exit(1);
        }
    }
}

Author

itchyny (https://github.com/itchyny)

License

This software is released under the MIT License, see LICENSE.

uptime-rs's People

Contributors

itchyny avatar matthiasbeyer avatar victorkoenders avatar

Stargazers

Joel Van Eenwyk avatar Said avatar Tomasz Durda avatar Luis Quiñones avatar  avatar Abhinav Saxena avatar Racci avatar  avatar FredHay avatar Aaron Leopold avatar Yakiyo avatar LukasDoesDev avatar Christoph Grabo avatar Cpt.Howdy avatar Tobias Bieniek avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

uptime-rs's Issues

Can we use pure rust?

I noticed we are using some other packages to get the uptime. This might be unnecessary as we can still use pure rust to do it for example on Linux we can read /proc/uptime directly and the output should be something like this

# in seconds
350735.47 234388.90

The windows crate is about 12MB in size!
What about using a solution that goes like this

let child = Command::new("systeminfo").output()?.stdout;
let output = String::from_utf8(child)?;
// ... extract the uptime from the output
```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.