Struct der::asn1::GeneralizedTime
source · pub struct GeneralizedTime(_);
Expand description
ASN.1 GeneralizedTime
type.
This type implements the validity requirements specified in RFC 5280 Section 4.1.2.5.2, namely:
For the purposes of this profile, GeneralizedTime values MUST be expressed in Greenwich Mean Time (Zulu) and MUST include seconds (i.e., times are
YYYYMMDDHHMMSSZ
), even where the number of seconds is zero. GeneralizedTime values MUST NOT include fractional seconds.
Implementations§
source§impl GeneralizedTime
impl GeneralizedTime
sourcepub const LENGTH: Length = _
pub const LENGTH: Length = _
Length of an RFC 5280-flavored ASN.1 DER-encoded GeneralizedTime
.
sourcepub fn from_date_time(datetime: DateTime) -> Self
pub fn from_date_time(datetime: DateTime) -> Self
Create a GeneralizedTime
from a DateTime
.
sourcepub fn to_date_time(&self) -> DateTime
pub fn to_date_time(&self) -> DateTime
Convert this GeneralizedTime
into a DateTime
.
sourcepub fn from_unix_duration(unix_duration: Duration) -> Result<Self>
pub fn from_unix_duration(unix_duration: Duration) -> Result<Self>
Create a new GeneralizedTime
given a Duration
since UNIX_EPOCH
(a.k.a. “Unix time”)
sourcepub fn to_unix_duration(&self) -> Duration
pub fn to_unix_duration(&self) -> Duration
Get the duration of this timestamp since UNIX_EPOCH
.
Trait Implementations§
source§impl Clone for GeneralizedTime
impl Clone for GeneralizedTime
source§fn clone(&self) -> GeneralizedTime
fn clone(&self) -> GeneralizedTime
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for GeneralizedTime
impl Debug for GeneralizedTime
source§impl DecodeValue<'_> for GeneralizedTime
impl DecodeValue<'_> for GeneralizedTime
source§impl EncodeValue for GeneralizedTime
impl EncodeValue for GeneralizedTime
source§impl From<&DateTime> for GeneralizedTime
impl From<&DateTime> for GeneralizedTime
source§impl From<&GeneralizedTime> for DateTime
impl From<&GeneralizedTime> for DateTime
source§fn from(utc_time: &GeneralizedTime) -> DateTime
fn from(utc_time: &GeneralizedTime) -> DateTime
Converts to this type from the input type.
source§impl From<&GeneralizedTime> for GeneralizedTime
impl From<&GeneralizedTime> for GeneralizedTime
source§fn from(value: &GeneralizedTime) -> GeneralizedTime
fn from(value: &GeneralizedTime) -> GeneralizedTime
Converts to this type from the input type.
source§impl From<DateTime> for GeneralizedTime
impl From<DateTime> for GeneralizedTime
source§impl From<GeneralizedTime> for DateTime
impl From<GeneralizedTime> for DateTime
source§fn from(utc_time: GeneralizedTime) -> DateTime
fn from(utc_time: GeneralizedTime) -> DateTime
Converts to this type from the input type.
source§impl Ord for GeneralizedTime
impl Ord for GeneralizedTime
source§fn cmp(&self, other: &GeneralizedTime) -> Ordering
fn cmp(&self, other: &GeneralizedTime) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<GeneralizedTime> for GeneralizedTime
impl PartialEq<GeneralizedTime> for GeneralizedTime
source§fn eq(&self, other: &GeneralizedTime) -> bool
fn eq(&self, other: &GeneralizedTime) -> bool
source§impl PartialOrd<GeneralizedTime> for GeneralizedTime
impl PartialOrd<GeneralizedTime> for GeneralizedTime
source§fn partial_cmp(&self, other: &GeneralizedTime) -> Option<Ordering>
fn partial_cmp(&self, other: &GeneralizedTime) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more