pub trait Clock:
Send
+ Sync
+ Debug {
// Required methods
fn now(&self) -> Instant;
fn timestamp_ms(&self) -> u64;
fn timestamp_rfc3339(&self) -> String;
fn timestamp_datetime(&self) -> DateTime<Utc>;
fn sleep<'life0, 'async_trait>(
&'life0 self,
duration: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn sleep_until<'life0, 'async_trait>(
&'life0 self,
deadline: Instant,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Runtime time source. Cloneable as Arc<dyn Clock>; carried on
RuntimeHostConfig.
Required Methods§
Sourcefn timestamp_ms(&self) -> u64
fn timestamp_ms(&self) -> u64
Wall-clock time as epoch milliseconds, for durable records.
Sourcefn timestamp_rfc3339(&self) -> String
fn timestamp_rfc3339(&self) -> String
Wall-clock time as an RFC 3339 string, for durable records.
Sourcefn timestamp_datetime(&self) -> DateTime<Utc>
fn timestamp_datetime(&self) -> DateTime<Utc>
Wall-clock time as a UTC datetime, for trace records.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".