Standard Clock module for Caryatid
The Clock module provides a regular tick event which can be used to drive time-based behaviour in other modules without having to create your own interval system.
Configuration
The Clock module doesn't need any configuration, it just needs to be mentioned in the top-level configuration:
[]
Messages
The Clock module sends a ClockTickMessage once a second, which is defined in the common
messages in the SDK:
The time is a DateTime in UTC, derived from a regular interval, which means although each tick may not be precisely one second after
the previous one, it won't drift over time, and the long-term average is exactly once per second. The number increments from zero at
startup each tick, and is a handy way to derive longer intervals with % - e.g.
if message.number % 60 == 0
Registration
The Clock module needs to be parameterised with the type of an outer message enum which contains a ClockTickMessage variant, and
provides a From implementation to promote one. For example, your system-wide message enum might be:
use ClockTickMessage;
Then within your main.rs you would register the Clock module into the process like this:
register;
See the typed example to see this in action.