pub struct TimeProvider { /* private fields */ }Expand description
Provides the estimated server time based on time sync messages.
Implementations§
Source§impl TimeProvider
impl TimeProvider
Sourcepub fn set_diff(&mut self, c2s: &Timeval, s2c: &Timeval)
pub fn set_diff(&mut self, c2s: &Timeval, s2c: &Timeval)
Set the time diff from a c2s/s2c latency pair (as received in Time messages).
The diff is computed as (c2s - s2c) / 2 which cancels out the symmetric
network latency, leaving only the clock difference.
Sourcepub fn set_diff_ms(&mut self, ms: f64)
pub fn set_diff_ms(&mut self, ms: f64)
Set the time diff directly in milliseconds.
Sourcepub fn diff_to_server_usec(&self) -> i64
pub fn diff_to_server_usec(&self) -> i64
Get the current diff to server in microseconds.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TimeProvider
impl RefUnwindSafe for TimeProvider
impl Send for TimeProvider
impl Sync for TimeProvider
impl Unpin for TimeProvider
impl UnsafeUnpin for TimeProvider
impl UnwindSafe for TimeProvider
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