xblax / flashforge_ad5m_klipper_mod

Unoffical mod for Flashforge Adventurer 5M (Pro) 3D printers to run Moonraker, custom Klipper, Mainsail & Fluidd
GNU General Public License v3.0
92 stars 5 forks source link

Time synchronization #14

Closed xblax closed 3 months ago

xblax commented 3 months ago

The printer has no built-in RTC. Startup time is currently always 1970. Timesync can be implemented via Busybox NTP client and fake RTC script so store last known time in a file.

Some discussion around that already started here: https://github.com/xblax/flashforge_adm5_klipper_mod/discussions/12#discussioncomment-8562308

I think UTC time should be sufficient. It is mainly required to allow connecting to external services and not fail TLS certificate verification.

xblax commented 3 months ago

I pushed this feature to master branch. Decided to keep ntpd running and periodically synchronizing instead of doing a "one-shot" time sync after boot. It takes basically no memory.

The positive thing is that the fake-hwclock is also periodically updated by busybox ntpd and the printer always remembers the last known time within ~10min accuracy after boot.

Time is set after all physical partitions were mounted, so I don't expect any issues with fsck.