When the GPS receiver is turned off for a day and then powered back, you will find the GPS receiver works fine by typing
cgps -s
Type the “ntpq -p” and return messages becomes
remote refid st t when poll reach delay offset jitter
====================================================================
SHM(0) .SHM. 1 l 205 16 0 0.000 15.675 0.000
LOCAL(0) .LOCL. 10 l 44 64 1 0.000 0.000 0.000
This means NTP server cannot sync the time with GPS receiver.
Check with /var/log/ntp.log
, you find
2 Sep 01:46:44 ntpd[2396]: SHM: difference limit exceeded, delta=71007s
2 Sep 01:46:45 ntpd[2396]: SHM: difference limit exceeded, delta=71007s
The error message “SHM: difference limit exceed, delta = 71007s” indicates that the time difference between the system clock and the GPS receiver’s time exceeds the maximum allowed limit for NTP synchronization. By default, NTP is configured to reject large time differences to avoid abrupt time changes that could disrupt system operations. You can verify this by checking the system clock by typing “date” command.
Maximum Time Difference for NTP Synchronization
- Default Limit:
The default maximum time difference that NTP will tolerate for synchronization is typically around 1000 seconds (approximately 16.67 minutes). If the difference exceeds this limit, NTP will not synchronize and will show the “difference limit exceeded” error. - Setting a Higher Limit:
You can increase the limit by configuring themaxpoll
option in the NTP configuration file, but caution is advised. Allowing larger time jumps can lead to instability or unexpected behavior in applications relying on accurate time.
Steps to Resolve Large Time Difference
Manual Synchronization:
First, manual change the time by tying the current time
sudo timedatectl set-time '2024-09-07 11:24:00'
Then wait for about 30 second and type the “ntpq -p”, return messages becomes
remote refid st t when poll reach delay offset jitter
=====================================================================
*SHM(0) .SHM. 1 l 15 16 1 0.000 3.608 0.000
LOCAL(0) .LOCL 10 l - 64 0 0.000 0.000 0.000
Next, you can manually synchronize the clock using
sudo systemctl restart ntp
Finally, you can reboot the system to ensure that all services restart properly and synchronize.
Conclusion
The local clock will not sync automatically if the time difference exceeds the default limit (approximately 1000 seconds). Manual update the time and synchronize help in these situations. Always be cautious with changes that allow large time jumps to maintain system stability. Later I will study and try to sync the time automatically using program.