Merge pull request #686 from Franklin-Qi/fix-#685-optimize-time-format-display-for-hugetop-command

hugetop: optimize time format display
This commit is contained in:
Sylvestre Ledru
2026-05-13 13:15:30 +02:00
committed by GitHub
3 changed files with 6 additions and 7 deletions
Generated
+1
View File
@@ -2345,6 +2345,7 @@ dependencies = [
name = "uu_hugetop"
version = "0.0.1"
dependencies = [
"chrono",
"clap",
"tempfile",
"uucore 0.7.0",
+1
View File
@@ -14,6 +14,7 @@ version.workspace = true
workspace = true
[dependencies]
chrono = { workspace = true }
clap = { workspace = true }
uucore = { workspace = true }
+4 -7
View File
@@ -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> = Local::now();
println!("hugetop - {}", now.format("%a %b %e %T %Y"));
let pools = match read_node_hugepage_pools() {
Ok(nodes) if numa => {