Skip to main content

Clock

Trait Clock 

Source
pub trait Clock {
    // Required method
    fn utc(&self) -> Option<u64>;

    // Provided methods
    fn set_utc(&self, _micros: u64) -> Result<()> { ... }
    fn granularity(&self) -> Granularity { ... }
}
Expand description

Wall-clock time in UTC.

Separate from Timer because most nodes do not have one: a light with no real-time clock and no Time Synchronization cluster implements NoClock and is none the worse. Matter never uses wall-clock time for protocol deadlines, only for the Time Synchronization cluster and for certificate validity.

Required Methods§

Source

fn utc(&self) -> Option<u64>

Microseconds since the Matter epoch — 2000-01-01 00:00:00 UTC — or None when the node does not know the time.

Provided Methods§

Source

fn set_utc(&self, _micros: u64) -> Result<()>

Sets the current time, if the platform can. A node that cannot returns Err(ErrorCode::Platform); the Time Synchronization cluster reports that honestly rather than pretending the write worked.

Source

fn granularity(&self) -> Granularity

How precise Clock::utc is, as the Time Synchronization cluster’s Granularity enumeration.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Clock for NoClock

Source§

impl Clock for SimNet

Source§

impl Clock for StdClock

Available on crate feature std only.