diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-12-03 12:24:25 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-12-03 12:24:25 +0100 |
commit | c0c2c235d0d90c7a56b763b08fa8c909aa389c82 (patch) | |
tree | d1231feeab301b23bf14848f405e34114e4fe47a /openpgp/src | |
parent | 3cb87c45a2a43fc85f5be4fed5e914fd4c15557c (diff) |
openpgp: Convert uses of Time::from_pgp.
Diffstat (limited to 'openpgp/src')
-rw-r--r-- | openpgp/src/lib.rs | 3 | ||||
-rw-r--r-- | openpgp/src/packet/signature/subpacket.rs | 13 | ||||
-rw-r--r-- | openpgp/src/parse/parse.rs | 5 | ||||
-rw-r--r-- | openpgp/src/parse/stream.rs | 5 |
4 files changed, 11 insertions, 15 deletions
diff --git a/openpgp/src/lib.rs b/openpgp/src/lib.rs index e001276c..505c9b32 100644 --- a/openpgp/src/lib.rs +++ b/openpgp/src/lib.rs @@ -157,8 +157,7 @@ mod tests; /// openpgp/tests/data/keys/neal.pgp are not expired. #[cfg(test)] fn frozen_time() -> std::time::SystemTime { - use crate::conversions::Time; - std::time::SystemTime::from_pgp(1554542220 - 1) + crate::types::Timestamp::from(1554542220 - 1).into() } /// Crate result specialization. diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs index f9d692f1..87f84845 100644 --- a/openpgp/src/packet/signature/subpacket.rs +++ b/openpgp/src/packet/signature/subpacket.rs @@ -3037,7 +3037,6 @@ fn subpacket_test_1 () { #[test] fn subpacket_test_2() { - use crate::conversions::Time; use crate::parse::Parse; use crate::PacketPile; @@ -3095,7 +3094,7 @@ fn subpacket_test_2() { // } assert_eq!(sig.signature_creation_time(), - Some(time::SystemTime::from_pgp(1515791508))); + Some(Timestamp::from(1515791508).into())); assert_eq!(sig.subpacket(SubpacketTag::SignatureCreationTime), Some(Subpacket { critical: false, @@ -3256,7 +3255,7 @@ fn subpacket_test_2() { // } assert_eq!(sig.signature_creation_time(), - Some(time::SystemTime::from_pgp(1515791490))); + Some(Timestamp::from(1515791490).into())); assert_eq!(sig.subpacket(SubpacketTag::SignatureCreationTime), Some(Subpacket { critical: false, @@ -3292,7 +3291,7 @@ fn subpacket_test_2() { // } assert_eq!(sig.signature_creation_time(), - Some(time::SystemTime::from_pgp(1515791376))); + Some(Timestamp::from(1515791376).into())); assert_eq!(sig.subpacket(SubpacketTag::SignatureCreationTime), Some(Subpacket { critical: false, @@ -3363,7 +3362,7 @@ fn subpacket_test_2() { // } assert_eq!(sig.signature_creation_time(), - Some(time::SystemTime::from_pgp(1515886658))); + Some(Timestamp::from(1515886658).into())); assert_eq!(sig.subpacket(SubpacketTag::SignatureCreationTime), Some(Subpacket { critical: false, @@ -3393,7 +3392,7 @@ fn subpacket_test_2() { // has multiple notations. assert_eq!(sig.signature_creation_time(), - Some(time::SystemTime::from_pgp(1515791467))); + Some(Timestamp::from(1515791467).into())); assert_eq!(sig.subpacket(SubpacketTag::SignatureCreationTime), Some(Subpacket { critical: false, @@ -3467,7 +3466,7 @@ fn subpacket_test_2() { // } assert_eq!(sig.signature_creation_time(), - Some(time::SystemTime::from_pgp(1515791223))); + Some(Timestamp::from(1515791223).into())); assert_eq!(sig.subpacket(SubpacketTag::SignatureCreationTime), Some(Subpacket { critical: false, diff --git a/openpgp/src/parse/parse.rs b/openpgp/src/parse/parse.rs index b49f5139..4776ba0a 100644 --- a/openpgp/src/parse/parse.rs +++ b/openpgp/src/parse/parse.rs @@ -36,7 +36,6 @@ use crate::types::{ SymmetricAlgorithm, Timestamp, }; -use crate::conversions::Time; use crate::crypto::{self, mpis::{PublicKey, MPI}}; use crate::crypto::symmetric::{Decryptor, BufferedReaderDecryptor}; use crate::message; @@ -1530,7 +1529,7 @@ impl Key4<key::UnspecifiedParts, key::UnspecifiedRole> -> Result<Key4<key::PublicParts, R>> where R: key::KeyRole { - Key4::new(std::time::SystemTime::from_pgp(creation_time), + Key4::new(Timestamp::from(creation_time), pk_algo, mpis) } fn s<R>(creation_time: u32, @@ -1540,7 +1539,7 @@ impl Key4<key::UnspecifiedParts, key::UnspecifiedRole> -> Result<Key4<key::SecretParts, R>> where R: key::KeyRole { - Key4::with_secret(std::time::SystemTime::from_pgp(creation_time), + Key4::with_secret(Timestamp::from(creation_time), pk_algo, mpis, secret) } diff --git a/openpgp/src/parse/stream.rs b/openpgp/src/parse/stream.rs index 7f0e5196..c272078d 100644 --- a/openpgp/src/parse/stream.rs +++ b/openpgp/src/parse/stream.rs @@ -1887,8 +1887,6 @@ mod test { // This test is relatively long running in debug mode. Split it // up. fn detached_verifier_read_size(l: usize) { - use crate::conversions::Time; - struct Test<'a> { sig: &'a [u8], content: &'a [u8], @@ -1905,7 +1903,8 @@ mod test { sig: crate::tests::message( "emmelie-dorothea-dina-samantha-awina-detached-signature-of-100MB-of-zeros.sig"), content: &vec![ 0; 100 * 1024 * 1024 ][..], - reference: time::SystemTime::from_pgp(1572602018), + reference: + crate::types::Timestamp::try_from(1572602018).unwrap().into(), }, ]; |