NTP and RTC HW Clock weird results

偶尔善良 提交于 2019-12-24 07:33:15

问题


In an attempt to make the system time on an ODroid as close to realtime as possible, I've tried adding a real time clock to the ODroid. The RTC has an accuracy of +/- 4ppm.

Without the realtimeclock, I would get results like this (Synced with NTP-server every 60 seconds). The blue is an Orange Pi for comparison. The x-axis is the sample, and the y-axis is the offset reported by the NTP-server in ms.

So what I tried, was the same thing (Though more samples, but same interval), but instead of just syncing with the NTP-server, I did the following:

  1. Set the system time to the hw-clock time.
  2. Sync with the NTP-server to update the system time, and record the offset given by the server
  3. Update the HW-clock to the systemtime, since it has just been synced to realtime.

Then I wait 60 seconds and repeat. I didn't expect it to be perfect, but what I got shocked me a little bit.

What in the world am I looking at? The jitter becomes less and less, and follows an almost straight line, but when it reaches the perfect time (about 410 minutes in....), it the seems to continue, and let the jitter and offset grow again.

Can anyone explain this, or maybe tell me what I'm doing wrong? This is weird!


回答1:


So you are plotting the difference between your RTC time and the NTP server time. Where is the NTP server located? In the second plot you are working in a range of a couple hundred ms. NTP has accuracy limitations. From wikipedia:

https://en.wikipedia.org/wiki/Network_Time_Protocol

NTP can usually maintain time to within tens of milliseconds over the public Internet, and can achieve better than one millisecond accuracy in local area networks under ideal conditions. Asymmetric routes and network congestion can cause errors of 100 ms or more

Your data is a bit weird looking though.



来源:https://stackoverflow.com/questions/42296554/ntp-and-rtc-hw-clock-weird-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!