From 5e0a69f68bcb3c894b20202e7162aa4f0fe7d5ce Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Mon, 9 Dec 2019 22:34:04 -0700 Subject: [PATCH] Improve get-epoch-info output for longer epoch durations --- Cargo.lock | 1 + cli/Cargo.toml | 1 + cli/src/cluster_query.rs | 6 +----- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 63e634a69..be2b76d62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3258,6 +3258,7 @@ dependencies = [ "criterion-stats 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "indicatif 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index bfeaa9735..f6eb9f3df 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -20,6 +20,7 @@ dirs = "2.0.2" lazy_static = "1.4.0" log = "0.4.8" indicatif = "0.13.0" +humantime = "1.3.0" num-traits = "0.2" pretty-hex = "0.1.1" reqwest = { version = "0.9.22", default-features = false, features = ["rustls-tls"] } diff --git a/cli/src/cluster_query.rs b/cli/src/cluster_query.rs index 2ce9c52ae..f3993800c 100644 --- a/cli/src/cluster_query.rs +++ b/cli/src/cluster_query.rs @@ -360,11 +360,7 @@ pub fn process_get_epoch_info( ); println_name_value( "Time remaining in current epoch:", - &format!( - "{} minutes, {} seconds", - remaining_time_in_epoch.as_secs() / 60, - remaining_time_in_epoch.as_secs() % 60 - ), + &humantime::format_duration(remaining_time_in_epoch).to_string(), ); Ok("".to_string()) }