Add boot_time command
@@ -111,6 +111,10 @@ fn print_help() {
&mut io::stdout(),
"uptime : Displays system uptime"
);
+ writeln!(
+ &mut io::stdout(),
+ "boot_time : Displays system boot time"
+ );
writeln!(
&mut io::stdout(),
"vendor_id : Displays processor vendor id"
@@ -316,7 +320,12 @@ fn interpret_input(input: &str, sys: &mut System) -> bool {
writeln!(&mut io::stdout(), "{:?}", user.get_name());
}
}
+ "boot_time" => {
+ let mut uptime = sys.get_boot_time();
+ writeln!(&mut io::stdout(), "{} seconds", sys.get_boot_time());
+ }
"uptime" => {
+ let up = sys.get_uptime();
let mut uptime = sys.get_uptime();
let days = uptime / 86400;
uptime -= days * 86400;
@@ -325,10 +334,11 @@ fn interpret_input(input: &str, sys: &mut System) -> bool {
let minutes = uptime / 60;
writeln!(
&mut io::stdout(),
- "{} days {} hours {} minutes",
+ "{} days {} hours {} minutes ({} seconds in total)",
days,
hours,
- minutes
+ minutes,
+ up,
);
}
x if x.starts_with("refresh") => {
