From 9bbb9634b44c0f9df4d6387ad21f70f2ed11e18e Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Tue, 3 Dec 2019 11:26:15 +0100 Subject: openpgp: Use Duration in SignatureExpirationTime. --- tool/src/commands/dump.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tool') diff --git a/tool/src/commands/dump.rs b/tool/src/commands/dump.rs index 54aa407b..6b696ff3 100644 --- a/tool/src/commands/dump.rs +++ b/tool/src/commands/dump.rs @@ -1,7 +1,7 @@ use std::io::{self, Read}; extern crate sequoia_openpgp as openpgp; -use self::openpgp::types::{Timestamp, SymmetricAlgorithm}; +use self::openpgp::types::{Duration, Timestamp, SymmetricAlgorithm}; use self::openpgp::conversions::hex; use self::openpgp::crypto::mpis; use self::openpgp::{Packet, Result}; @@ -34,6 +34,12 @@ impl Convert for std::time::Duration { } } +impl Convert for Duration { + fn convert(self) -> chrono::Duration { + chrono::Duration::seconds(self.as_secs() as i64) + } +} + impl Convert> for std::time::SystemTime { fn convert(self) -> chrono::DateTime { chrono::DateTime::::from(self) @@ -733,7 +739,7 @@ impl PacketDumper { write!(output, "{} Signature expiration time: {} ({})", i, t.convert(), if let Some(creation) = sig.signature_creation_time() { - (creation + *t).convert().to_string() + (creation + t.clone().into()).convert().to_string() } else { " (no Signature Creation Time subpacket)".into() })?, -- cgit v1.2.3