pub struct Time48(/* private fields */);
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 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 PartialOrd for Time48
impl PartialOrd for Time48
impl Copy for Time48
impl Eq for Time48
impl StructuralPartialEq for Time48
Auto Trait Implementations§
impl Freeze for Time48
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<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
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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) -> Target
fn octets_into(self) -> Target
Performs an infallible conversion.