Struct x509_parser::time::ASN1Time
source · pub struct ASN1Time(/* private fields */);
Expand description
An ASN.1 timestamp.
Implementations§
source§impl ASN1Time
impl ASN1Time
pub const fn new(dt: OffsetDateTime) -> Self
pub const fn to_datetime(&self) -> OffsetDateTime
sourcepub fn from_timestamp(secs: i64) -> Result<Self, X509Error>
pub fn from_timestamp(secs: i64) -> Result<Self, X509Error>
Makes a new ASN1Time
from the number of non-leap seconds since Epoch
sourcepub fn timestamp(&self) -> i64
pub fn timestamp(&self) -> i64
Returns the number of non-leap seconds since January 1, 1970 0:00:00 UTC (aka “UNIX timestamp”).
sourcepub fn to_rfc2822(self) -> Result<String, String>
pub fn to_rfc2822(self) -> Result<String, String>
Returns an RFC 2822 date and time string such as Tue, 1 Jul 2003 10:52:37 +0200
.
Conversion to RFC2822 date can fail if date cannot be represented in this format, for example if year < 1900.
For an infallible conversion to string, use .to_string()
.
Trait Implementations§
source§impl From<OffsetDateTime> for ASN1Time
impl From<OffsetDateTime> for ASN1Time
source§fn from(dt: OffsetDateTime) -> Self
fn from(dt: OffsetDateTime) -> Self
Converts to this type from the input type.
source§impl<'a> FromDer<'a, X509Error> for ASN1Time
impl<'a> FromDer<'a, X509Error> for ASN1Time
source§fn from_der(i: &[u8]) -> X509Result<'_, Self>
fn from_der(i: &[u8]) -> X509Result<'_, Self>
Attempt to parse input bytes into a DER object (enforcing constraints)
source§impl Ord for ASN1Time
impl Ord for ASN1Time
source§impl PartialOrd for ASN1Time
impl PartialOrd for ASN1Time
impl Copy for ASN1Time
impl Eq for ASN1Time
impl StructuralPartialEq for ASN1Time
Auto Trait Implementations§
impl Freeze for ASN1Time
impl RefUnwindSafe for ASN1Time
impl Send for ASN1Time
impl Sync for ASN1Time
impl Unpin for ASN1Time
impl UnwindSafe for ASN1Time
Blanket Implementations§
source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)