Skip to main content

Clock

Trait Clock 

Source
pub trait Clock:
    Send
    + Sync
    + Debug {
    // Required method
    fn now(&self) -> DateTime<Utc>;
}
Expand description

Provides the current time for session expiry calculations.

Implementors must be Send + Sync so they can be shared across async tasks via Arc<dyn Clock>.

§Examples

use mcp_execution_server::clock::{Clock, SystemClock};

let clock = SystemClock;
assert!(clock.now().timestamp() > 0);

Required Methods§

Source

fn now(&self) -> DateTime<Utc>

Returns the current time.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§