pub struct ClockSync { /* private fields */ }Expand description
Clock synchronization state
Implementations§
Source§impl ClockSync
impl ClockSync
Sourcepub fn process_sync(&mut self, t1: u64, t2: u64, t3: u64, t4: u64)
pub fn process_sync(&mut self, t1: u64, t2: u64, t3: u64, t4: u64)
Process a sync response
§Arguments
t1- Client send timet2- Server receive timet3- Server send timet4- Client receive time
Sourcepub fn server_time(&self) -> Timestamp
pub fn server_time(&self) -> Timestamp
Get estimated server time
Sourcepub fn to_server_time(&self, local: Timestamp) -> Timestamp
pub fn to_server_time(&self, local: Timestamp) -> Timestamp
Convert local time to server time
Sourcepub fn to_local_time(&self, server: Timestamp) -> Timestamp
pub fn to_local_time(&self, server: Timestamp) -> Timestamp
Convert server time to local time
Sourcepub fn needs_sync(&self, interval_secs: u64) -> bool
pub fn needs_sync(&self, interval_secs: u64) -> bool
Check if sync is needed (e.g., every 30 seconds)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClockSync
impl RefUnwindSafe for ClockSync
impl Send for ClockSync
impl Sync for ClockSync
impl Unpin for ClockSync
impl UnsafeUnpin for ClockSync
impl UnwindSafe for ClockSync
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