Skip to content
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

get_uptime method does not work #110

Closed
wmorgue opened this issue Feb 6, 2018 · 4 comments
Closed

get_uptime method does not work #110

wmorgue opened this issue Feb 6, 2018 · 4 comments

Comments

@wmorgue
Copy link
Contributor

wmorgue commented Feb 6, 2018

I compiled this code:

extern crate sysinfo;

use sysinfo::SystemExt;

fn main() {
    let mut system = sysinfo::System::new();
    system.refresh_all();
    println!("uptime: {} ", system.get_uptime());
}

and when I try to run it, I get the following output:

uptime: 0

Real uptime:

$ uptime -p
$ up 6 hours, 27 minutes

OS: Manjaro Linux
Kernel: 4.14.16-1-MANJARO

@GuillaumeGomez
Copy link
Owner

Outch you're right! The error:

let content = get_all_data("/proc/mounts").unwrap_or(String::new());

and should be:

let content = get_all_data("/proc/uptime").unwrap_or(String::new());

@wmorgue
Copy link
Contributor Author

wmorgue commented Feb 6, 2018

@GuillaumeGomez maybe I'll fix it in PR ?

@GuillaumeGomez
Copy link
Owner

As you prefer. The fix is written and I'm fixing it and adding tests. But if you want you can change the line, I don't mind (I'll still write the tests however 😉 ).

@GuillaumeGomez
Copy link
Owner

GuillaumeGomez commented Feb 6, 2018

So what do you decide? I let you make the PR? :)

@wmorgue wmorgue mentioned this issue Feb 6, 2018
@wmorgue wmorgue closed this as completed Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants