pub struct TimeSyncConfig {
pub sync_interval: Duration,
pub auto_sync: bool,
pub max_offset_drift: i64,
}Expand description
Time synchronization configuration.
Controls the behavior of the TimeSyncManager including sync intervals,
automatic sync, and drift tolerance.
§Example
use ccxt_exchanges::binance::time_sync::TimeSyncConfig;
use std::time::Duration;
let config = TimeSyncConfig {
sync_interval: Duration::from_secs(30),
auto_sync: true,
max_offset_drift: 5000,
};Fields§
§sync_interval: DurationSync interval duration.
The time between automatic resyncs when auto_sync is enabled.
Default: 30 seconds.
auto_sync: boolEnable automatic periodic sync.
When enabled, needs_resync() will return true after the sync interval
has elapsed since the last sync.
Default: true.
max_offset_drift: i64Maximum allowed time offset drift in milliseconds.
This value represents the maximum acceptable drift before forcing a resync.
Should be less than Binance’s recvWindow (default 5000ms) to ensure
signed requests are accepted.
Default: 5000ms.
Implementations§
Source§impl TimeSyncConfig
impl TimeSyncConfig
Sourcepub fn with_interval(sync_interval: Duration) -> Self
pub fn with_interval(sync_interval: Duration) -> Self
Creates a new configuration with the specified sync interval.
§Arguments
sync_interval- Duration between automatic resyncs
§Example
use ccxt_exchanges::binance::time_sync::TimeSyncConfig;
use std::time::Duration;
let config = TimeSyncConfig::with_interval(Duration::from_secs(60));
assert_eq!(config.sync_interval, Duration::from_secs(60));Sourcepub fn manual_sync_only() -> Self
pub fn manual_sync_only() -> Self
Creates a configuration with automatic sync disabled.
Useful when you want to control sync timing manually.
§Example
use ccxt_exchanges::binance::time_sync::TimeSyncConfig;
let config = TimeSyncConfig::manual_sync_only();
assert!(!config.auto_sync);Trait Implementations§
Source§impl Clone for TimeSyncConfig
impl Clone for TimeSyncConfig
Source§fn clone(&self) -> TimeSyncConfig
fn clone(&self) -> TimeSyncConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more