pub struct NtpPacket {Show 13 fields
pub leap: LeapIndicator,
pub version: u8,
pub mode: u8,
pub stratum: u8,
pub poll: i8,
pub precision: i8,
pub root_delay: u32,
pub root_dispersion: u32,
pub reference_id: [u8; 4],
pub reference_ts: NtpTimestamp,
pub origin_ts: NtpTimestamp,
pub receive_ts: NtpTimestamp,
pub transmit_ts: NtpTimestamp,
}Expand description
NTPv4 packet (48 bytes, RFC 5905).
Fields§
§leap: LeapIndicatorLeap indicator (2 bits)
version: u8Version number (3 bits)
mode: u8Mode (3 bits)
stratum: u8Stratum level (0 = unspecified, 1 = primary, 2-15 = secondary)
poll: i8Maximum interval between successive messages (log2 seconds)
precision: i8Precision of the system clock (log2 seconds)
root_delay: u32Total round-trip delay to the reference source (NTP short format, 16.16)
root_dispersion: u32Maximum error relative to the reference source (NTP short format, 16.16)
reference_id: [u8; 4]Reference identifier (stratum 1: 4-char ASCII, else: IP address)
reference_ts: NtpTimestampTime when the system clock was last set
origin_ts: NtpTimestampTime at the client when the request departed
receive_ts: NtpTimestampTime at the server when the request arrived
transmit_ts: NtpTimestampTime at the server when the response departed
Implementations§
Source§impl NtpPacket
impl NtpPacket
Sourcepub fn new_request(transmit_ts: NtpTimestamp) -> Self
pub fn new_request(transmit_ts: NtpTimestamp) -> Self
Create a new client request packet.
Sourcepub fn from_bytes(buf: &[u8]) -> Option<Self>
pub fn from_bytes(buf: &[u8]) -> Option<Self>
Deserialize from a 48-byte slice.
Trait Implementations§
impl Eq for NtpPacket
impl StructuralPartialEq for NtpPacket
Auto Trait Implementations§
impl Freeze for NtpPacket
impl RefUnwindSafe for NtpPacket
impl Send for NtpPacket
impl Sync for NtpPacket
impl Unpin for NtpPacket
impl UnwindSafe for NtpPacket
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)