|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
Multi-source time fallback matrix (PROTOCORE_ENABLE_TIME_SOURCE). More...
#include "protocore_config.h"Go to the source code of this file.
Typedefs | |
| typedef uint32_t(* | TimeSourceFn) (void) |
| A time source: returns the current Unix epoch seconds for this source, or 0 if it currently has no valid time. | |
Multi-source time fallback matrix (PROTOCORE_ENABLE_TIME_SOURCE).
A small, zero-heap registry of user-defined time sources (NTP, an RTC, GPS, a manually-set clock, ...). Each source is a callback returning the current Unix epoch seconds, or 0 when that source currently has no valid time. Sources are registered with a priority; protocore_time_now() queries them in ascending priority order and returns the first nonzero result, so the device falls back automatically when its preferred clock is unavailable (e.g. GPS loses its fix -> RTC -> NTP). The validity rule lives in each user callback (return 0 when invalid/stale), keeping this layer a pure prioritizer.
Everything lives in a fixed BSS table (PROTOCORE_TIME_SOURCE_MAX entries); no heap. The whole core is host-testable. The API is declared unconditionally and compiles to no-op stubs when PROTOCORE_ENABLE_TIME_SOURCE is 0.
Definition in file time_source.h.
| typedef uint32_t(* TimeSourceFn) (void) |
A time source: returns the current Unix epoch seconds for this source, or 0 if it currently has no valid time.
Sits outside the feature gate: the disabled build still defines the no-op registry entry points, so it has to be able to spell their argument type.
Definition at line 37 of file time_source.h.