summaryrefslogtreecommitdiffstats
path: root/openpgp/src/types/timestamp.rs
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-02-10 11:00:17 +0100
committerNeal H. Walfield <neal@pep.foundation>2020-02-10 11:01:00 +0100
commit24dd586cd415ced18aaec2e7c3595fecaa847019 (patch)
tree3da8878fb89e2c31b9b502c829588d02514424fd /openpgp/src/types/timestamp.rs
parenta6b4d781a954c2a991684d2bd07b60ac3069f026 (diff)
openpgp: Add Timestamp::MAX.
- Add a constant to represent the latest time representable by a `Timestamp`.
Diffstat (limited to 'openpgp/src/types/timestamp.rs')
-rw-r--r--openpgp/src/types/timestamp.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/openpgp/src/types/timestamp.rs b/openpgp/src/types/timestamp.rs
index cbb423b7..adbca03b 100644
--- a/openpgp/src/types/timestamp.rs
+++ b/openpgp/src/types/timestamp.rs
@@ -1,6 +1,7 @@
use std::convert::{TryFrom, TryInto};
use std::fmt;
use std::time::{SystemTime, Duration as SystemDuration, UNIX_EPOCH};
+use std::u32;
use quickcheck::{Arbitrary, Gen};
use crate::{
@@ -306,6 +307,7 @@ impl Duration {
#[allow(unused)]
impl Timestamp {
pub(crate) const UNIX_EPOCH : Timestamp = Timestamp(0);
+ pub(crate) const MAX : Timestamp = Timestamp(u32::MAX);
// for y in $(seq 1970 2106); do echo " const Y$y : Timestamp = Timestamp($(date -u --date="Jan. 1, $y" '+%s'));"; done
pub(crate) const Y1970 : Timestamp = Timestamp(0);