My Raspberry Pi:s clock is drifting, how do I keep it as accurate as possible?

3.5k views Asked by At

The Raspberry Pi has no real clock to keep track of time. Instead it uses the NTP daemon to keep date and time as accurate as possible. This should work, I guess, but in my case it doesn't for some reason.

Without going into too much detail, I use my Raspberry Pi in a way where it's always plugged in but doesn't always have an Internet connection. Sometimes the CPU has allot to do. Sometimes it doesn't. This results in the Rpi losing track of time. I would think that once it gets back on the Internet, it would sync the clock using the NTP servers to get back on track. However, it doesn't. From what I understand, if the offset is too big, the system doesn't sync the time.

Is there any way to force NTPD to sync the time no matter how big the offset is compared to the NTP servers? Or will I have to set up a cronjob say every hour running:

ntpd -g"
2

There are 2 answers

0
Matthew On

Add this to /etc/ntp.conf:

tinker panic 0

That will cause ntpd to sync despite the large clock offset.

0
Udo Klein On

You need to add a real time clock as a local clock. I suggest you shop for something with 3ppm or better accuracy. Then set it up as a stratum 10 clock. You may also connect a stratum 0 clock, e.g. a wwvb, msf or dcf77 receiver. However in all cases you need a reasonable local clock. That is your only chance to keep accurate timing is to add an RTC.