diff --git a/Cargo.lock b/Cargo.lock index 078cb8ee..b3460387 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2361,6 +2361,7 @@ dependencies = [ name = "uu_hugetop" version = "0.0.1" dependencies = [ + "chrono", "clap", "tempfile", "uucore 0.7.0", diff --git a/src/uu/hugetop/Cargo.toml b/src/uu/hugetop/Cargo.toml index aa0eea47..983bfea8 100644 --- a/src/uu/hugetop/Cargo.toml +++ b/src/uu/hugetop/Cargo.toml @@ -14,6 +14,7 @@ version.workspace = true workspace = true [dependencies] +chrono = { workspace = true } clap = { workspace = true } uucore = { workspace = true } diff --git a/src/uu/hugetop/src/hugetop.rs b/src/uu/hugetop/src/hugetop.rs index ee17ed53..53c6fed1 100644 --- a/src/uu/hugetop/src/hugetop.rs +++ b/src/uu/hugetop/src/hugetop.rs @@ -3,12 +3,13 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +use chrono::{DateTime, Local}; use clap::{value_parser, Arg, Command}; use std::collections::BTreeMap; use std::fs; use std::path::Path; use std::thread::sleep; -use std::time::{Duration, SystemTime, UNIX_EPOCH}; +use std::time::Duration; use uucore::error::UResult; const DEFAULT_HUGEPAGES_ROOT: &str = "/sys/kernel/mm/hugepages"; @@ -122,12 +123,8 @@ pub fn uu_app() -> Command { } fn print_summary(numa: bool, human: bool) { - let now = SystemTime::now() - .duration_since(UNIX_EPOCH) - .map(|d| d.as_secs()) - .unwrap_or_default(); - - println!("hugetop - {}", now); + let now: DateTime = Local::now(); + println!("hugetop - {}", now.format("%a %b %e %T %Y")); let pools = match read_node_hugepage_pools() { Ok(nodes) if numa => {