pub struct UtcTime(_);
Expand description
ASN.1 UTCTime
type.
This type implements the validity requirements specified in RFC 5280 Section 4.1.2.5.1, namely:
For the purposes of this profile, UTCTime values MUST be expressed in Greenwich Mean Time (Zulu) and MUST include seconds (i.e., times are
YYMMDDHHMMSSZ
), even where the number of seconds is zero. Conforming systems MUST interpret the year field (YY
) as follows:
- Where
YY
is greater than or equal to 50, the year SHALL be interpreted as19YY
; and- Where
YY
is less than 50, the year SHALL be interpreted as20YY
.
Implementations§
source§impl UtcTime
impl UtcTime
sourcepub fn to_date_time(&self) -> DateTime
pub fn to_date_time(&self) -> DateTime
sourcepub fn from_unix_duration(unix_duration: Duration) -> Result<Self>
pub fn from_unix_duration(unix_duration: Duration) -> Result<Self>
sourcepub fn to_unix_duration(&self) -> Duration
pub fn to_unix_duration(&self) -> Duration
Get the duration of this timestamp since UNIX_EPOCH
.
sourcepub fn from_system_time(time: SystemTime) -> Result<Self>
Available on crate feature std
only.
pub fn from_system_time(time: SystemTime) -> Result<Self>
std
only.Instantiate from SystemTime
.
sourcepub fn to_system_time(&self) -> SystemTime
Available on crate feature std
only.
pub fn to_system_time(&self) -> SystemTime
std
only.Convert to SystemTime
.
Trait Implementations§
source§impl<'a> Arbitrary<'a> for UtcTime
Available on crate feature arbitrary
only.
impl<'a> Arbitrary<'a> for UtcTime
Available on crate feature
arbitrary
only.source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Generate an arbitrary value of
Self
from the given unstructured data. Read moresource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured
this type
needs to construct itself. Read moresource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moresource§impl<'a> DecodeValue<'a> for UtcTime
impl<'a> DecodeValue<'a> for UtcTime
source§impl EncodeValue for UtcTime
impl EncodeValue for UtcTime
source§impl From<UtcTime> for SystemTime
Available on crate feature std
only.
impl From<UtcTime> for SystemTime
Available on crate feature
std
only.source§fn from(utc_time: UtcTime) -> SystemTime
fn from(utc_time: UtcTime) -> SystemTime
Converts to this type from the input type.
source§impl Ord for UtcTime
impl Ord for UtcTime
source§impl PartialEq<UtcTime> for UtcTime
impl PartialEq<UtcTime> for UtcTime
source§impl PartialOrd<UtcTime> for UtcTime
impl PartialOrd<UtcTime> for UtcTime
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