Struct solana_sdk::timing::AtomicInterval
source · pub struct AtomicInterval { /* private fields */ }
Implementations§
source§impl AtomicInterval
impl AtomicInterval
sourcepub fn should_update(&self, interval_time_ms: u64) -> bool
pub fn should_update(&self, interval_time_ms: u64) -> bool
true if ‘interval_time_ms’ has elapsed since last time we returned true as long as it has been ‘interval_time_ms’ since this struct was created
sourcepub fn should_update_ext(&self, interval_time_ms: u64, skip_first: bool) -> bool
pub fn should_update_ext(&self, interval_time_ms: u64, skip_first: bool) -> bool
a primary use case is periodic metric reporting, potentially from different threads true if ‘interval_time_ms’ has elapsed since last time we returned true except, if skip_first=false, false until ‘interval_time_ms’ has elapsed since this struct was created
sourcepub fn elapsed_ms(&self) -> u64
pub fn elapsed_ms(&self) -> u64
return ms elapsed since the last time the time was set
sourcepub fn remaining_until_next_interval(&self, interval_time: u64) -> u64
pub fn remaining_until_next_interval(&self, interval_time: u64) -> u64
return ms until the interval_time will have elapsed
Trait Implementations§
source§impl Debug for AtomicInterval
impl Debug for AtomicInterval
source§impl Default for AtomicInterval
impl Default for AtomicInterval
source§fn default() -> AtomicInterval
fn default() -> AtomicInterval
Returns the “default value” for a type. Read more