0

I want to add a h/w rtc to my RPi. If network time is available, I want to determine this, and use it to set the system time and also update my own rtc. How can I find if network time is ( or becomes ) available ( preferably within a Python program)?

BobT
  • 794
  • 4
  • 7
Neville
  • 1
  • 1

1 Answers1

0

DS1302/DS1307 are quite precise to be left alone without network sync for a long while, you may sync them manually right after the installation and forget about them.

however if you still insist to update your hw-clock from the network, I'd recommend to keep your NTP daemon running and create:

  • a small script running right after the boot, that reads hw-clock and sets the system time

and

  • a regularly running cron script, that will compare current system time and hw-clock time, if these differ substantially, the system clock must be reset by NTP daemon and you may want to copy the system clock to the nw-clock.
lenik
  • 11,533
  • 2
  • 32
  • 37