summaryrefslogtreecommitdiffstats
path: root/openpgp/src/cert.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2021-11-17 12:50:46 +0100
committerJustus Winter <justus@sequoia-pgp.org>2021-11-18 14:10:55 +0100
commitb56ea7ab07626ff37e14f0c15c6252b7627a6b72 (patch)
tree595c6a5d11b2db7e9141384a32762052440193ce /openpgp/src/cert.rs
parent991c759dd710bab903baa32dff8dc1fc18e78e3b (diff)
openpgp: Use a WASM-friendly SystemTime::now wrapper.
- Fixes #769.
Diffstat (limited to 'openpgp/src/cert.rs')
-rw-r--r--openpgp/src/cert.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/openpgp/src/cert.rs b/openpgp/src/cert.rs
index 19dccd3f..fb74c2c8 100644
--- a/openpgp/src/cert.rs
+++ b/openpgp/src/cert.rs
@@ -1050,7 +1050,7 @@ impl Cert {
-> Result<ValidUserIDAmalgamation<'a>>
where T: Into<Option<std::time::SystemTime>>
{
- let t = t.into().unwrap_or_else(std::time::SystemTime::now);
+ let t = t.into().unwrap_or_else(crate::now);
ValidComponentAmalgamation::primary(self, self.userids.iter(),
policy, t, valid_cert)
}
@@ -2830,7 +2830,7 @@ impl Cert {
-> Result<ValidCert<'a>>
where T: Into<Option<time::SystemTime>>,
{
- let time = time.into().unwrap_or_else(time::SystemTime::now);
+ let time = time.into().unwrap_or_else(crate::now);
self.primary_key().with_policy(policy, time)?;
Ok(ValidCert {
@@ -4842,7 +4842,7 @@ mod test {
assert_match!(RevocationStatus::Revoked(_) = cert.revocation_status(p, t34));
assert_match!(RevocationStatus::Revoked(_) = cert.revocation_status(p, t4));
assert_match!(RevocationStatus::Revoked(_)
- = cert.revocation_status(p, time::SystemTime::now()));
+ = cert.revocation_status(p, crate::now()));
}
#[test]
@@ -4999,7 +4999,7 @@ mod test {
crate::tests::key(
&format!("really-revoked-{}-0-public.pgp", f))).unwrap();
- let now = time::SystemTime::now();
+ let now = crate::now();
let selfsig0
= cert.userids().with_policy(p, now).map(|b| {
b.binding_signature().signature_creation_time().unwrap()
@@ -5246,7 +5246,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g=
let cert = Cert::from_bytes(
crate::tests::key("really-revoked-userid-0-public.pgp")).unwrap();
- let now = time::SystemTime::now();
+ let now = crate::now();
let selfsig0
= cert.userids().with_policy(p, now).map(|b| {
b.binding_signature().signature_creation_time().unwrap()