Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion der/src/asn1/generalized_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl GeneralizedTime {
const LENGTH: usize = 15;

/// Create a [`GeneralizedTime`] from a [`DateTime`].
pub fn from_date_time(datetime: DateTime) -> Self {
pub const fn from_date_time(datetime: DateTime) -> Self {
Self(datetime)
}

Expand Down
12 changes: 12 additions & 0 deletions der/src/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ pub struct DateTime {
}

impl DateTime {
/// This is the maximum date represented by the [`DateTime`]
/// This corresponds to: 9999-12-31T23:59:59Z
pub const INFINITY: DateTime = DateTime {
year: 9999,
month: 12,
day: 31,
hour: 23,
minutes: 59,
seconds: 59,
unix_duration: MAX_UNIX_DURATION,
};

/// Create a new [`DateTime`] from the given UTC time components.
// TODO(tarcieri): checked arithmetic
#[allow(clippy::integer_arithmetic)]
Expand Down