Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I keep raspberry timekeeping accurate?

I have 3 Raspberry 3 Model B devices. Their operation system is Windows 10 IOT, they were installed on the same day (yesterday).

I have very strange experiences with their timekeeping, they are highly inaccurate. Some of them some secs behind the correct time, while others 3-4 minutes. The common behaviour is inaccurancy.

I try to force time sync at every startup by calling "w32tm /resync /force" in a startup scheduled script. It does not seem to help at all.

I also tried to use different Wi-Fi networks (from different vendors), the problem exists on all of them.

When queriing time status by w32tm /query /status I get the following results:

Device 1

Leap Indicator: 3(last minute has 61 seconds) Stratum: 0 (unspecified) Precision: -23 (119.209ns per tick) Root Delay: 0.0000000s Root Dispersion: 0.0000000s ReferenceId: 0x00000000 (unspecified) Last Successful Sync Time: unspecified Source: Local CMOS Clock Poll Interval: 10 (1024s)

Device 2

Leap Indicator: 0(no warning) Stratum: 3 (secondary reference - syncd by (S)NTP) Precision: -23 (119.209ns per tick) Root Delay: 0.1734432s Root Dispersion: 0.4173777s ReferenceId: 0x338C7FC5 (source IP: 51.140.127.197) Last Successful Sync Time: 7/14/2017 7:48:12 AM Source: time.windows.com,0x9 Poll Interval: 15 (32768s)

Device 3

Leap Indicator: 0(no warning) Stratum: 3 (secondary reference - syncd by (S)NTP) Precision: -23 (119.209ns per tick) Root Delay: 0.1850726s Root Dispersion: 16.7226250s ReferenceId: 0x338C7FC5 (source IP: 51.140.127.197) Last Successful Sync Time: 7/14/2017 11:42:52 AM Source: time.windows.com,0x9 Poll Interval: 10 (1024s)

I read topics over the net about the issue, but I could not find any working solution. I seems very strange for me, time should be critical factor in the majority of applications, so there must be a solution.

Would you be so kind to help me to solve it? Any suggestions are highly appriciated!

like image 340
Tom Avatar asked Jul 14 '17 09:07

Tom


People also ask

How does the RPI maintain accurate time?

Time keeping Because the Raspberry Pi is designed as an ultra-low cost computer, it lacks the little coin-battery-powered 'Real Time Clock' (RTC) module that sits in your laptop or desktop computer. Instead, the Raspberry Pi updates the time automatically from the global ntp (nework time protocol) servers.

Does Raspberry Pi keep time when powered off?

The reason for an RTC is that the clock keeps running when the Raspberry is powered off, so the system powers back on with something close to the right time of day.

Does Raspberry Pi remember time?

The Raspberry Pi doesn't have a Real Time Clock, like a PC does. Thus, it will lose time when shut down. With no Internet connection it has no way to sync its time with a Time server. Normally it will remember the time when it was shut down.

How do I automatically update the time on my Raspberry Pi?

As a general rule, you'll use raspi-config to set the date and time on a Lite version or the Raspberry Pi configuration tool if you have a desktop environment. You can also use the command sudo timedatectl set-time 'HH:mm:ss' to set the time in one command.


1 Answers

Device 1 does not seem to use a timeserver at all, enforce the same config on all devices.

I would simply suggest you to try a different timeserver. I've had similiar issues, sometimes this is not even hardware related but a network thing. Noone knows what is between you and a timeserver and it can be sufficient to try a different network then.

http://www.pool.ntp.org/en/use.html

w32tm /config /syncfromflags:manual /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org"

It should be good enough... but the RPi has no RTC (Real Time Clock) onboard. You can buy one tho, google for raspberry pie rtc.

Without an RTC, the RPi builds a time with its CPU cycles. These are not as super accurate and can be even more drifting when you overclock the CPU.

This question could maybe be better answered on https://raspberrypi.stackexchange.com/

If you don't want to buy the chip, you could try to change the voltage and let the time update more often from the timeservers.

like image 131
Daniel W. Avatar answered Oct 06 '22 17:10

Daniel W.