summaryrefslogtreecommitdiffstats
path: root/openpgp/src/policy.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/policy.rs
parent991c759dd710bab903baa32dff8dc1fc18e78e3b (diff)
openpgp: Use a WASM-friendly SystemTime::now wrapper.
- Fixes #769.
Diffstat (limited to 'openpgp/src/policy.rs')
-rw-r--r--openpgp/src/policy.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/openpgp/src/policy.rs b/openpgp/src/policy.rs
index 934f7c12..889326c2 100644
--- a/openpgp/src/policy.rs
+++ b/openpgp/src/policy.rs
@@ -2155,7 +2155,7 @@ mod test {
let mut reject : StandardPolicy = StandardPolicy::new();
reject.reject_hash_at(
algo,
- SystemTime::now().checked_add(Duration::from_secs(SECS_IN_YEAR)));
+ crate::now().checked_add(Duration::from_secs(SECS_IN_YEAR)));
reject.hash_revocation_tolerance(0);
cert.primary_key().binding_signature(&reject, None)?;
assert_match!(RevocationStatus::Revoked(_)
@@ -2165,7 +2165,7 @@ mod test {
let mut reject : StandardPolicy = StandardPolicy::new();
reject.reject_hash_at(
algo,
- SystemTime::now().checked_sub(Duration::from_secs(SECS_IN_YEAR)));
+ crate::now().checked_sub(Duration::from_secs(SECS_IN_YEAR)));
reject.hash_revocation_tolerance(0);
assert!(cert.primary_key()
.binding_signature(&reject, None).is_err());
@@ -2177,7 +2177,7 @@ mod test {
let mut reject : StandardPolicy = StandardPolicy::new();
reject.reject_hash_at(
algo,
- SystemTime::now().checked_sub(Duration::from_secs(SECS_IN_YEAR)));
+ crate::now().checked_sub(Duration::from_secs(SECS_IN_YEAR)));
reject.hash_revocation_tolerance(2 * SECS_IN_YEAR as u32);
assert!(cert.primary_key()
.binding_signature(&reject, None).is_err());
@@ -2190,10 +2190,10 @@ mod test {
assert!(algo_u8 != 0u8);
reject.reject_hash_at(
(algo_u8 - 1).into(),
- SystemTime::now().checked_sub(Duration::from_secs(SECS_IN_YEAR)));
+ crate::now().checked_sub(Duration::from_secs(SECS_IN_YEAR)));
reject.reject_hash_at(
(algo_u8 + 1).into(),
- SystemTime::now().checked_sub(Duration::from_secs(SECS_IN_YEAR)));
+ crate::now().checked_sub(Duration::from_secs(SECS_IN_YEAR)));
reject.hash_revocation_tolerance(0);
cert.primary_key().binding_signature(&reject, None)?;
assert_match!(RevocationStatus::Revoked(_)
@@ -2205,7 +2205,7 @@ mod test {
let mut reject : StandardPolicy = StandardPolicy::new();
reject.reject_hash_at(
algo,
- SystemTime::now().checked_sub(Duration::from_secs(SECS_IN_YEAR)));
+ crate::now().checked_sub(Duration::from_secs(SECS_IN_YEAR)));
reject.hash_revocation_tolerance(0);
assert!(cert.primary_key()
.binding_signature(&reject, None).is_err());