pub struct TimerManager;Expand description
Global timer manager providing unified interface for time synchronization and access
Implementations§
Source§impl TimerManager
impl TimerManager
Sourcepub async fn init_global_timer(config: Arc<Config>) -> Result<(), TimerError>
pub async fn init_global_timer(config: Arc<Config>) -> Result<(), TimerError>
Initializes the global timer (lazy initialization).
On first call, fetches NTP timestamp and starts background sync task. Subsequent calls are no-op if already initialized.
Sourcepub fn get_timestamp() -> Result<i64, TimerError>
pub fn get_timestamp() -> Result<i64, TimerError>
Gets the current timestamp via fast local path (<0.1ms).
§Errors
Returns TimerError::NotInitialized if init_global_timer was not called.
Sourcepub async fn manual_sync() -> Result<i64, TimerError>
pub async fn manual_sync() -> Result<i64, TimerError>
手动同步 NTP
Auto Trait Implementations§
impl Freeze for TimerManager
impl RefUnwindSafe for TimerManager
impl Send for TimerManager
impl Sync for TimerManager
impl Unpin for TimerManager
impl UnsafeUnpin for TimerManager
impl UnwindSafe for TimerManager
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