NTP 和 RTC 硬件时钟奇怪的结果 [英] NTP and RTC HW Clock weird results

查看:77
本文介绍了NTP 和 RTC 硬件时钟奇怪的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了使 ODroid 上的系统时间尽可能接近实时,我尝试向 ODroid 添加实时时钟.RTC 的精度为 +/- 4ppm.

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.

如果没有实时时钟,我会得到这样的结果(每 60 秒与 NTP 服务器同步).蓝色是用于比较的橙色 Pi.x 轴是样本,y 轴是 NTP 服务器报告的偏移量(以毫秒为单位).

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.

所以我尝试的是同样的事情(尽管样本更多,但间隔相同),但我不仅与 NTP 服务器同步,还执行了以下操作:

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. 将系统时间设置为 hw-clock 时间.
  2. 与NTP服务器同步更新系统时间,并记录服务器给出的偏移量
  3. 将硬件时钟更新为系统时间,因为它刚刚同步到实时.

然后我等待 60 秒并重复.我没想到它是完美的,但我得到的东西让我有点震惊.

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

我到底在看什么?抖动越来越小,几乎是一条直线,但是当它达到完美的时间(大约 410 分钟......)时,它似乎还在继续,让抖动和偏移再次增长.

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!

推荐答案

所以您正在绘制 RTC 时间和 NTP 服务器时间之间的差异.NTP 服务器位于何处?在第二个图中,您在几百毫秒的范围内工作.NTP 具有准确性限制.来自维基百科:

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 通常可以将时间保持在几十毫秒以内公共互联网,并且可以达到优于一毫秒的精度在理想条件下的局域网中.非对称路由和网络拥塞会导致 100 毫秒或更多的错误

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.

这篇关于NTP 和 RTC 硬件时钟奇怪的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆