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-04-23 11:58:35 +0200
commit1e8ae411f2988ce711cf87c22587de761b3e00eb (patch)
treede6da72d53e5009fd09a911b900ed3fa34d95258
parent33892580b08b72950b81522c1874ffa793a1ba42 (diff)
openpgp: Make test more robust.me
- 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));