pub struct UtcTime(/* private fields */);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
YYis greater than or equal to 50, the year SHALL be interpreted as19YY; and- Where
YYis less than 50, the year SHALL be interpreted as20YY.
Note: Due to common operations working on UNIX_EPOCH UtcTimes are
only supported for the years 1970-2049.
Implementations§
Source§impl UtcTime
impl UtcTime
Sourcepub fn from_date_time(datetime: DateTime) -> Result<Self>
pub fn from_date_time(datetime: DateTime) -> Result<Self>
Create a UtcTime from a DateTime.
§Errors
Returns Error in the event datetime has a year that exceeds UtcTime::MAX_YEAR.
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>
pub fn from_system_time(time: SystemTime) -> Result<Self>
Sourcepub fn to_system_time(&self) -> SystemTime
pub fn to_system_time(&self) -> SystemTime
Convert to SystemTime.
Trait Implementations§
Source§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
1.21.0 (const: unstable) · 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 PartialOrd for UtcTime
impl PartialOrd for UtcTime
impl Copy for UtcTime
impl Eq for UtcTime
impl StructuralPartialEq for UtcTime
Auto Trait Implementations§
impl Freeze for UtcTime
impl RefUnwindSafe for UtcTime
impl Send for UtcTime
impl Sync for UtcTime
impl Unpin for UtcTime
impl UnsafeUnpin for UtcTime
impl UnwindSafe for UtcTime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag + 'a,
impl<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag + 'a,
Source§type Error = <T as DecodeValue<'a>>::Error
type Error = <T as DecodeValue<'a>>::Error
Type returned in the event of a decoding error.
Source§fn decode<R>(reader: &mut R) -> Result<T, <T as DecodeValue<'a>>::Error>where
R: Reader<'a>,
fn decode<R>(reader: &mut R) -> Result<T, <T as DecodeValue<'a>>::Error>where
R: Reader<'a>,
Attempt to decode this TLV message using the provided decoder. Read more
Source§impl<T> Encode for T
impl<T> Encode for T
Source§fn encoded_len(&self) -> Result<Length, Error>
fn encoded_len(&self) -> Result<Length, Error>
Compute the length of this TLV object in bytes when encoded as ASN.1 DER. Read more
Source§fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
Encode this TLV object to the provided byte slice, returning a sub-slice
containing the encoded message. Read more
Source§impl<T> IsConstructed for T
impl<T> IsConstructed for T
Source§const CONSTRUCTED: bool = const CONSTRUCTED: bool = T::TAG.is_constructed();
const CONSTRUCTED: bool = const CONSTRUCTED: bool = T::TAG.is_constructed();
ASN.1 constructed bit