#[repr(C)]pub struct DateFormat {
pub era_number: i32,
pub era_offset: u32,
pub fraction: u64,
}Expand description
NTP Date Format - The prime epoch, or base date of era 0, is 0 h 1 January 1900 UTC, when all bits are zero. Dates are relative to the prime epoch; values greater than zero represent times after that date; values less than zero represent times before it.
Note that the era_offset field has the same interpretation as the seconds field of the
TimestampFormat type.
ⓘ
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Era Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Era Offset |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Fraction |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Fields§
§era_number: i32Era number (signed 32-bit integer).
era_offset: u32Offset within the era in seconds (32-bit unsigned).
fraction: u64Fractional seconds (64-bit unsigned).
Trait Implementations§
Source§impl Clone for DateFormat
impl Clone for DateFormat
Source§fn clone(&self) -> DateFormat
fn clone(&self) -> DateFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ConstPackedSizeBytes for DateFormat
impl ConstPackedSizeBytes for DateFormat
Source§const PACKED_SIZE_BYTES: usize = 16
const PACKED_SIZE_BYTES: usize = 16
The constant size in bytes when this type is packed for network transmission.
Source§impl Debug for DateFormat
impl Debug for DateFormat
Source§impl Default for DateFormat
impl Default for DateFormat
Source§fn default() -> DateFormat
fn default() -> DateFormat
Returns the “default value” for a type. Read more
Source§impl From<DateFormat> for Instant
impl From<DateFormat> for Instant
Source§fn from(d: DateFormat) -> Self
fn from(d: DateFormat) -> Self
Converts a 128-bit NTP date format (with explicit era) to a Unix Instant.
This conversion is unambiguous because protocol::DateFormat includes the era number.
Source§impl From<Instant> for DateFormat
impl From<Instant> for DateFormat
Source§impl FromBytes for DateFormat
impl FromBytes for DateFormat
Source§fn from_bytes(buf: &[u8]) -> Result<(Self, usize), ParseError>
fn from_bytes(buf: &[u8]) -> Result<(Self, usize), ParseError>
Parse from the given byte slice. Returns the parsed value and the
number of bytes consumed from the front of
buf.Source§impl Hash for DateFormat
impl Hash for DateFormat
Source§impl Ord for DateFormat
impl Ord for DateFormat
Source§fn cmp(&self, other: &DateFormat) -> Ordering
fn cmp(&self, other: &DateFormat) -> Ordering
1.21.0 · 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 PartialEq for DateFormat
impl PartialEq for DateFormat
Source§impl PartialOrd for DateFormat
impl PartialOrd for DateFormat
Source§impl ReadFromBytes for DateFormat
Available on crate feature std only.
impl ReadFromBytes for DateFormat
Available on crate feature
std only.Source§fn read_from_bytes<R: ReadBytesExt>(reader: R) -> Result<Self>
fn read_from_bytes<R: ReadBytesExt>(reader: R) -> Result<Self>
Read the command from bytes.
Source§impl ToBytes for DateFormat
impl ToBytes for DateFormat
Source§fn to_bytes(&self, buf: &mut [u8]) -> Result<usize, ParseError>
fn to_bytes(&self, buf: &mut [u8]) -> Result<usize, ParseError>
Write this value into the given byte slice. Returns the number of bytes
written. Fails with
ParseError::BufferTooShort if buf is too short.Source§impl WriteToBytes for DateFormat
Available on crate feature std only.
impl WriteToBytes for DateFormat
Available on crate feature
std only.Source§fn write_to_bytes<W: WriteBytesExt>(&self, writer: W) -> Result<()>
fn write_to_bytes<W: WriteBytesExt>(&self, writer: W) -> Result<()>
Write the command to bytes.
impl Copy for DateFormat
impl Eq for DateFormat
impl StructuralPartialEq for DateFormat
Auto Trait Implementations§
impl Freeze for DateFormat
impl RefUnwindSafe for DateFormat
impl Send for DateFormat
impl Sync for DateFormat
impl Unpin for DateFormat
impl UnsafeUnpin for DateFormat
impl UnwindSafe for DateFormat
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