Use crate humantime to format durations.

This commit is contained in:
Justus Winter 2023-12-15 13:04:43 +01:00
parent 4f2a22b604
commit 5b5f528368
No known key found for this signature in database
GPG Key ID: 686F55B4AB2B3386
3 changed files with 8 additions and 6 deletions

1
Cargo.lock generated
View File

@ -3133,6 +3133,7 @@ dependencies = [
"dirs",
"dot-writer",
"fehler",
"humantime",
"is-terminal",
"itertools 0.12.0",
"predicates",

View File

@ -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"

View File

@ -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())
}
}