Keeps the system clock (UTC) right.
The Nest restores UTC from its battery-backed RTC at boot, but nothing
corrects it afterwards: Nest's own NTP client lived in connmand, which
isn't reliable once the stock stack is off. This asks NTP servers (SNTP over
UDP 123) shortly after start and then every :clock_sync_interval_ms,
steps the system clock when it is out by :clock_step_ms or more, and saves
it to the RTC after every successful check so the next boot starts right.
Servers are tried in order from :time_servers (host names, IPv4 tuples, or
:gateway for the default router).
Apps that already talk to a trusted HTTPS server can pass its Date header
to observe/2 as a fallback: it only corrects the clock when NTP hasn't
succeeded for 12 hours and the difference is over 30 seconds.
Local time and daylight saving are the app's concern; this only keeps UTC.
The VM must run with +C multi_time_warp (as app_watchdog.sh does) so
Erlang's own time follows a stepped clock.
Summary
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec observe(DateTime.t(), term()) :: :ok
Reports the UTC time according to another source (e.g. an HTTPS Date
header). Used only as a fallback when NTP has been failing.
@spec status() :: map()
When and how the clock was last checked.
Queries NTP now and corrects the clock if needed.