Struct retina::NtpTimestamp
source · pub struct NtpTimestamp(pub u64);
Expand description
A wallclock time represented using the format of the Network Time Protocol.
NTP timestamps are in a fixed-point representation of seconds since 0h UTC on 1 January 1900. The top 32 bits represent the integer part (wrapping around every 68 years) and the bottom 32 bits represent the fractional part.
This is a simple wrapper around a u64
in that format, with a Display
impl that writes the timestamp as a human-readable string. Currently this
assumes the time is within 68 years of 1970; the string will be incorrect
after 2038-01-19T03:14:07Z
.
An NtpTimestamp
isn’t necessarily gathered from a real NTP server.
Reported NTP timestamps are allowed to jump backwards and/or be complete
nonsense.
The NTP timestamp of the Unix epoch is available via the constant UNIX_EPOCH
.
Tuple Fields§
§0: u64
Trait Implementations§
source§impl Clone for NtpTimestamp
impl Clone for NtpTimestamp
source§fn clone(&self) -> NtpTimestamp
fn clone(&self) -> NtpTimestamp
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for NtpTimestamp
impl Debug for NtpTimestamp
source§impl Display for NtpTimestamp
impl Display for NtpTimestamp
source§impl Ord for NtpTimestamp
impl Ord for NtpTimestamp
source§fn cmp(&self, other: &NtpTimestamp) -> Ordering
fn cmp(&self, other: &NtpTimestamp) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for NtpTimestamp
impl PartialEq for NtpTimestamp
source§fn eq(&self, other: &NtpTimestamp) -> bool
fn eq(&self, other: &NtpTimestamp) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for NtpTimestamp
impl PartialOrd for NtpTimestamp
source§fn partial_cmp(&self, other: &NtpTimestamp) -> Option<Ordering>
fn partial_cmp(&self, other: &NtpTimestamp) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more