Timekeeper is responsible for starting and maintaining the UTC clock. For more information on the design of UTC on Fuchsia please refer to UTC architecture. To understand the observable behavior of UTC on Fuchsia please refer to UTC behavior
Timekeeper connects to the
fuchsia.time.Maintenance service to acquire a writable handle to the UTC clock on launch. It launches and connects to a time source component (or components) and connects to
fuchsia.time.external.PushSource to receive time synchronization information.
Timekeeper also connects to the Real Time Clock (RTC) driver using
fuchsia.hardware.rtc if one is found in
/dev/class/rtc, reading the RTC at initialization and updating it each time a new time sample is received from a time source.
The algorithms used in Timekeeper are documented and explained at UTC algorithms.
Timekeeper is composed of the following Rust modules:
|Entry point for the component that handles initialization and delegation to the other modules.|
|A collection of simple enumerations that are used across the other modules and in particular are used to bridge the operational and diagnostics modules.|
|Abstracts discovery of and interaction with the real time clock driver away from other modules.|
|Abstracts the launching and interaction with time sources away from other modules. Produces a stream of time source events.|
|Maintains a functional connection to a time source by using |
|Abstracts the details of the Kalman filter and frequency correction algorithms away from other modules. |
|Maintains a kernel clock object using |
|Provides a common trait to supply timekeeping events of note to diagnostics systems and implements this trait for Cobalt and Inspect.|
Because timekeeper is implemented in Rust, we recommend that you consult the Fuchsia Rust documentation.
timekeeper itself is included in the
core product configuration, no specific
fx set is needed to ensure it is included in an image.
Timekeeper is covered by both unit tests and integration tests. These are not included by default so should be added to the available packages using
fx set or
//src/sys/time/timekeeper:testsand may be executed with
fx test timekeeper-tests.
//src/sys/time/timekeeper_integrationand may be executed with
fx test timekeeper-integration