From 1d405a6b91d44d2e4afd4a166e60136144ca95de Mon Sep 17 00:00:00 2001 From: mikkeli Date: Thu, 8 Oct 2026 09:24:33 +0900 Subject: [PATCH] Pin NTP to NICT, set Tokyo timezone; add time sync report timesyncd now uses ntp.nict.jp (stratum 1), with the JP pool and Ubuntu as fallback, over whichever uplink holds the default route. Timezone moves from Asia/Yakutsk to Asia/Tokyo: same offset, right place. Records that the RTC loses time at power-off (the cold boot came up at June 4 until NTP synced), and the planned chrony + gpsd setup once GNSS has a fix. Co-Authored-By: Claude Opus 5.5 --- docs/impl/reports/TIME-SYNC.md | 51 ++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 docs/impl/reports/TIME-SYNC.md diff --git a/docs/impl/reports/TIME-SYNC.md b/docs/impl/reports/TIME-SYNC.md new file mode 100644 index 0000000..95e4cd6 --- /dev/null +++ b/docs/impl/reports/TIME-SYNC.md @@ -0,0 +1,51 @@ +--- +type: report +date: 2026-10-08 +--- +# Time Sync and Timezone + +## Result + +| Item | State | +|------|-------| +| Network time | `systemd-timesyncd`, primary `ntp.nict.jp` (stratum 1), synced over whichever uplink holds the default route (Ethernet / WiFi / LTE) | +| Timezone | `Asia/Tokyo` (was `Asia/Yakutsk`: same +09:00 and no DST either, but the wrong place) | +| Clock across power-off | **Not kept.** The RTC has no backup battery (see below) | +| GPS time | Not yet. Waiting on a GNSS fix (see [SIM7600 report](SIM7600-SETUP.md)) | + +## RTC loses time when powered off + +On the 2026-10-08 cold boot, the kernel set the system clock from `rtc0` (`nvvrs-pseq-rtc`, `hctosys=1`) to **June 4**. +Then the clock was corrected in two steps: + +1. ~12 s: timesyncd stepped forward to its last saved timestamp (`/var/lib/systemd/timesync/clock`). This is close, but behind by however long the board was off. +2. ~43 s: first NTP sync corrected the rest. The kernel then writes the synced time back to the RTC, which only lasts until the next power-off. + +Until step 2, timestamps are wrong, and with no uplink (in the car, out of coverage) they stay wrong. The fix is hardware: +an RTC backup battery (see [BOM](../../BOM.md#rtc-backup-battery)). `rtc1` (`tegra_rtc`) isn't used for boot time and reads 1970. + +## Configuration + +``` +sudo timedatectl set-timezone Asia/Tokyo +``` + +`/etc/systemd/timesyncd.conf.d/10-servers.conf`: + +``` +# Japan-local primary (NICT, national time standard), global pool as backup. +[Time] +NTP=ntp.nict.jp +FallbackNTP=ntp.ubuntu.com 0.jp.pool.ntp.org 1.jp.pool.ntp.org 2.jp.pool.ntp.org +``` + +`sudo systemctl restart systemd-timesyncd`, then check with `timedatectl timesync-status` (server, stratum, offset). + +## Later: GPS as a time source + +timesyncd only speaks NTP. Once GNSS has a fix, replace it with `chrony`, configured with: + +- the same NTP servers as above, which remain the default whenever any uplink exists, and +- a gpsd refclock (`refclock SHM 0`), which takes over when offline. + +NMEA over the USB serial port carries no PPS signal, so GPS time alone is only good to tens of milliseconds. That is plenty for log timestamps.