nerves-time / nerves_time

Keep time in sync on Nerves devices
Other
23 stars 13 forks source link

Fix crash when setting the time #69

Closed fhunleth closed 4 years ago

fhunleth commented 4 years ago

This fixes a "crash" that would happen after setting the system time. Thanks to process supervision, this would delay ntpd from starting. Here is the log message that changes with the fix:

00:01:30.052 [info]  RTC (NervesTime.FileTime) reports that the time is ~N[2020-02-19 00:01:30]

00:01:30.087 [warn]  ntpd crash detected. Delaying next start...

With the fix, the log looks something like this:

00:00:17.469 [info]  RTC (NervesTime.FileTime) reports that the time is ~N[2020-02-19 01:13:49]

01:13:49.002 [info]  nerves_time set system clock to 2020-02-19 01:13:49 UTC

01:13:49.028 [debug] Starting /usr/sbin/ntpd with: ["-n", "-S", "/srv/erlang/lib/nerves_time-0.4.0/priv/ntpd_script", "-p", "0.pool.ntp.org", "-p", "1.pool.ntp.org", "-p", "2.pool.ntp.org", "-p", "3.pool.ntp.org"]