Use crate humantime to format durations.
This commit is contained in:
parent
4f2a22b604
commit
5b5f528368
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -3133,6 +3133,7 @@ dependencies = [
|
||||
"dirs",
|
||||
"dot-writer",
|
||||
"fehler",
|
||||
"humantime",
|
||||
"is-terminal",
|
||||
"itertools 0.12.0",
|
||||
"predicates",
|
||||
|
@ -39,6 +39,7 @@ sequoia-policy-config = "0.6"
|
||||
anyhow = "1.0.18"
|
||||
chrono = "0.4.10"
|
||||
clap = { version = "4", features = ["derive", "env", "string", "wrap_help"] }
|
||||
humantime = "2"
|
||||
itertools = ">=0.10, <0.13"
|
||||
sequoia-cert-store = "0.4"
|
||||
sequoia-wot = "0.9"
|
||||
|
12
src/sq.rs
12
src/sq.rs
@ -75,15 +75,15 @@ pub trait Convert<T> {
|
||||
fn convert(self) -> T;
|
||||
}
|
||||
|
||||
impl Convert<chrono::Duration> for std::time::Duration {
|
||||
fn convert(self) -> chrono::Duration {
|
||||
chrono::Duration::seconds(self.as_secs() as i64)
|
||||
impl Convert<humantime::FormattedDuration> for std::time::Duration {
|
||||
fn convert(self) -> humantime::FormattedDuration {
|
||||
humantime::format_duration(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl Convert<chrono::Duration> for openpgp::types::Duration {
|
||||
fn convert(self) -> chrono::Duration {
|
||||
chrono::Duration::seconds(self.as_secs() as i64)
|
||||
impl Convert<humantime::FormattedDuration> for openpgp::types::Duration {
|
||||
fn convert(self) -> humantime::FormattedDuration {
|
||||
humantime::format_duration(self.into())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user