summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2024-04-23 11:40:31 +0200
committerJustus Winter <justus@sequoia-pgp.org>2024-05-07 09:10:33 +0200
commit605b0561a5051704fa10ca80b7679a3a75c0b67a (patch)
tree623ebdedcd293b4edb47d386050c349ed2597dca
parent6e260668026b06c56a415ad8e5def252413706c5 (diff)
openpgp: Make test more robust.
- Currently, the reference time is not set, hence evaluated to the current time on demand. If `now` is at the end of a whole second (OpenPGP's time resolution), it may be that we are off by one second. Explicitly set the reference time to avoid this. - See #998.
-rw-r--r--openpgp/src/packet/signature.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/openpgp/src/packet/signature.rs b/openpgp/src/packet/signature.rs
index 510134fe..6af03296 100644
--- a/openpgp/src/packet/signature.rs
+++ b/openpgp/src/packet/signature.rs
@@ -4403,6 +4403,7 @@ mod test {
SubpacketValue::SignatureExpirationTime(hour_t), true)?)?;
Ok(a)
})?;
+ let sig = sig.set_reference_time(now);
assert_eq!(sig.signature_expiration_time(), Some(now + hour));
let sig = sig.set_reference_time(past);
assert_eq!(sig.signature_expiration_time(), Some(now - hour));