api work
This commit is contained in:
@@ -32,6 +32,14 @@ impl TickTask {
|
||||
single_future: SingleFuture::new(),
|
||||
}
|
||||
}
|
||||
pub fn new_ms(tick_period_ms: u32) -> Self {
|
||||
Self {
|
||||
last_timestamp_us: AtomicU64::new(0),
|
||||
tick_period_us: (tick_period_ms as u64) * 1000u64,
|
||||
routine: OnceCell::new(),
|
||||
single_future: SingleFuture::new(),
|
||||
}
|
||||
}
|
||||
pub fn new(tick_period_sec: u32) -> Self {
|
||||
Self {
|
||||
last_timestamp_us: AtomicU64::new(0),
|
||||
|
@@ -41,6 +41,10 @@ pub fn secs_to_timestamp(secs: f64) -> u64 {
|
||||
(secs * 1000000.0f64) as u64
|
||||
}
|
||||
|
||||
pub fn ms_to_us(ms: u32) -> u64 {
|
||||
(ms as u64) * 1000u64
|
||||
}
|
||||
|
||||
// Calculate retry attempt with logarhythmic falloff
|
||||
pub fn retry_falloff_log(
|
||||
last_us: u64,
|
||||
|
Reference in New Issue
Block a user