Skip to content

feat(ntp): one-shot sync and Registry-configurable NTP servers (#26) - #697

Merged
alexis900 merged 1 commit into
developfrom
feat/26-ntp-client
Oct 13, 2026
Merged

alexis900 merged 1 commit into
developfrom
feat/26-ntp-client

Conversation

@alexis900

Copy link
Copy Markdown
Collaborator

Fixes #26.

Status before this PR

The SNTP client was already implemented:

  • libntp — request build + reply parse (mode/stratum/KoD/originate checks), offset/delay, civil-time conversion; 19/19 host unit tests.
  • ntpd daemon — DNS resolve, UDP exchange, ob_set_datetime(), periodic sync (Interval/Timeout/Enabled), status published to Registry.

Missing vs the issue's architecture: a one-shot tool (ntpdate) and reliable defaults.

Changes

  • ntpd once (-q/--once) performs a single synchronization and exits (0 synced, 1 not) — the ntpdate role, reusing the daemon rather than a duplicated binary.
  • gen-hiv: default Ntpd\Parameters\Servers = pool.ntp.org;time.cloudflare.com;time.google.com. Fallbacks live in configuration, not hardcoded.
  • docs: userland.md 3.6.

VirtualBox evidence (NAT, e1000, guest 10.0.2.15)

C:\> ntpd once
[ntpd] querying pool.ntp.org (172.233.111.193)
[ntpd] synced: offset=198ms delay=0ms stratum=2
[ntpd] one-shot sync complete

The auto-started daemon also synced (offset=1520ms). QEMU neodev test: 953/953.

- ntpd: `ntpd once` (or -q/--once) performs a single sync and exits (the
  `ntpdate` role) instead of only running the periodic daemon.
- gen-hiv: default Ntpd\Parameters\Servers = pool.ntp.org;time.cloudflare.com;
  time.google.com (fallbacks live in configuration, not code) so first sync is
  reliable behind NAT.
- docs: userland.md section 3.6.

The SNTP client itself (libntp: request/reply parse, offset/delay, civil time;
19/19 host unit tests) and the periodic daemon (ob_set_datetime, Interval/
Timeout/Enabled) were already implemented.

Verified: QEMU 953/953; VirtualBox (NAT, e1000): `ntpd once` ->
'synced: offset=198ms delay=0ms stratum=2', 'one-shot sync complete'; the
auto-started daemon also synced (offset=1520ms).
@alexis900
alexis900 merged commit 58628ea into develop Oct 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

B3.4: NTP client

1 participant