pub struct Time48(_);
Expand description
A 48-bit Unix timestamp.
Implementations§
source§impl Time48
impl Time48
sourcepub fn now() -> Time48
pub fn now() -> Time48
Returns the timestamp of the current moment.
The funtion will panic if for whatever reason the current moment is too far in the future to fit into this type. For a correctly set clock, this will happen in December 8,921,556, so should be fine.
sourcepub fn from_u64(value: u64) -> Self
pub fn from_u64(value: u64) -> Self
Creates a value from a 64 bit integer.
The upper 16 bits of the arument must be zero or else this function
panics. This is also why we don’t implement From
.
sourcepub fn into_octets(self) -> [u8; 6]
pub fn into_octets(self) -> [u8; 6]
Converts a value into its wire format.
Returns the octets of the encoded value in network byte order.
sourcepub fn eq_fudged(self, other: Self, fudge: u64) -> bool
pub fn eq_fudged(self, other: Self, fudge: u64) -> bool
Returns whether the time is within a given period.
Returns true
iff other
is at most fudge
seconds before or after
this value’s time.
pub fn flatten_into(self) -> Result<Self, PushError>
pub fn parse<Octs: AsRef<[u8]> + ?Sized>( parser: &mut Parser<'_, Octs> ) -> Result<Self, ParseError>
pub fn compose<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target ) -> Result<(), Target::AppendError>
Trait Implementations§
source§impl Ord for Time48
impl Ord for Time48
source§impl PartialEq<Time48> for Time48
impl PartialEq<Time48> for Time48
source§impl PartialOrd<Time48> for Time48
impl PartialOrd<Time48> for Time48
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 moreimpl Copy for Time48
impl Eq for Time48
impl StructuralEq for Time48
impl StructuralPartialEq for Time48
Auto Trait Implementations§
impl RefUnwindSafe for Time48
impl Send for Time48
impl Sync for Time48
impl Unpin for Time48
impl UnwindSafe for Time48
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<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
source§fn try_octets_into(
self
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.
source§fn octets_into(self) -> Targetwhere
Self::Error: Into<Infallible>,
fn octets_into(self) -> Targetwhere Self::Error: Into<Infallible>,
Performs an infallible conversion.