![ntp 服务器](https://i-blog.csdnimg.cn/blog_migrate/a3bf3cbabe8698618e91d4f83702a04f.png)
ntp 服务器
![how-do-ntp-servers-manage-to-stay-so-accurate-00 how-do-ntp-servers-manage-to-stay-so-accurate-00](https://i-blog.csdnimg.cn/blog_migrate/2a927318f01c1690e1c2f153f4064670.png)
Many of us have had the occasional problem with our computers and other devices retaining accurate time settings, but a quick sync with an NTP server makes all well again. But if our own devices can lose accuracy, how do NTP servers manage to stay so accurate?
我们中的许多人偶尔会遇到问题,因为我们的计算机和其他设备保留了准确的时间设置,但是与NTP服务器的快速同步又使一切恢复了正常。 但是,如果我们自己的设备可能会失去准确性,那么NTP服务器如何保持这种准确性?
Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.
今天的“问答”环节由SuperUser提供,它是Stack Exchange的一个分支,该社区是由社区驱动的Q&A网站分组。
Photo courtesy of LEOL30 (Flickr).
图片由LEOL30(Flickr)提供 。
问题 (The Question)
SuperUser reader Frank Thornton wants to know how NTP servers are able to remain so accurate:
超级用户读者Frank Thornton想知道NTP服务器如何保持如此精确:
I have noticed that on my servers and other machines, the clocks always drift so that they have to sync up to remain accurate. How do the NTP server clocks keep from drifting and always remain so accurate?
我已经注意到,在我的服务器和其他计算机上,时钟总是在漂移,因此它们必须同步才能保持准确。 NTP服务器时钟如何避免漂移并始终保持如此精确?
How do the NTP servers manage to remain so accurate?
NTP服务器如何保持如此精确?
答案 (The Answer)
SuperUser contributor Michael Kjorling has the answer for us:
超级用户贡献者Michael Kjorling为我们提供了答案:
NTP servers rely on highly accurate clocks for precision timekeeping. A common time source for central NTP servers are atomic clocks, or GPS receivers (remember that GPS satellites have atomic clocks onboard). These clocks are defined as accurate since they provide a highly exact time reference.
NTP服务器依靠高度精确的时钟进行精确计时。 中央NTP服务器的常见时间源是原子钟或GPS接收器(请记住,GPS卫星具有板载原子钟)。 这些时钟被定义为准确的,因为它们提供了高度精确的时间参考。
There is nothing magical about GPS or atomic clocks that make them tell you exactly what time it is. Because of how atomic clocks work, they are simply very good at, having once been told what time it is, keeping accurate time (since the second is defined in terms of atomic effects). In fact, it is worth noting that GPS time is distinct from the UTC that we are more used to seeing. These atomic clocks are in turn synchronized against International Atomic Time or TAI in order to not only accurately tell the passage of time, but also the time.
GPS或原子钟并没有什么神奇的功能可以使它们准确地告诉您现在几点了。 由于原子钟的工作方式,它们非常擅长,一旦被告知现在是什么时间,就可以保持准确的时间(因为秒数是根据原子效应定义的 )。 实际上,值得注意的是, GPS时间不同于我们更习惯看到的UTC 。 这些原子钟将依次对同步国际原子时或TAI为了不仅准确说出时间的推移,也有时间。
Once you have an exact time on one system connected to a network like the Internet, it is a matter of protocol engineering enabling transfer of precise times between hosts over an unreliable network. In this regard a Stratum 2 (or farther from the actual time source) NTP server is no different from your desktop system syncing against a set of NTP servers.
一旦在连接到网络(如Internet)的系统上有了准确的时间,就可以通过协议工程解决问题,从而可以通过不可靠的网络在主机之间传输准确的时间。 在这方面,Stratum 2(或距离实际时间源更远的地方)的NTP服务器与您的桌面系统在针对一组NTP服务器进行同步方面没有什么不同。
By the time you have a few accurate times (as obtained from NTP servers or elsewhere) and know the rate of advancement of your local clock (which is easy to determine), you can calculate your local clock’s drift rate relative to the “believed accurate” passage of time. Once locked in, this value can then be used to continuously adjust the local clock to make it report values very close to the accurate passage of time, even if the local real-time clock itself is highly inaccurate. As long as your local clock is not highly erratic, this should allow keeping accurate time for some time even if your upstream time source becomes unavailable for any reason.
等到您有几个准确的时间(从NTP服务器或其他地方获取)并知道本地时钟的提升速率(这很容易确定)时,您就可以计算本地时钟相对于“准确的”的漂移速率“ 时间流逝。 锁定后,即使本地实时时钟本身非常不准确,此值也可用于连续调整本地时钟,使其报告的值非常接近准确的时间流逝。 只要您的本地时钟不是很不稳定 ,即使您的上游时间源由于任何原因不可用,这也应允许将准确时间保持一段时间。
Some NTP client implementations (probably most ntpd daemon or system service implementations) do this, and others (like ntpd’s companion ntpdate which simply sets the clock once) do not. This is commonly referred to as a drift file because it persistently stores a measure of clock drift, but strictly speaking it does not have to be stored as a specific file on disk.
一些NTP客户端实现(可能是大多数ntpd守护程序或系统服务实现)可以执行此操作,而其他一些实现(例如ntpd的同伴ntpdate只需设置一次时钟)就不会这样做。 这通常称为漂移文件,因为它永久存储时钟漂移的量度,但是严格来说,它不必作为特定文件存储在磁盘上。
In NTP, Stratum 0 is by definition an accurate time source. Stratum 1 is a system that uses a Stratum 0 time source as its time source (and is thus slightly less accurate than the Stratum 0 time source). Stratum 2 again is slightly less accurate than Stratum 1 because it is syncing its time against the Stratum 1 source and so on. In practice, this loss of accuracy is so small that it is completely negligible in all but the most extreme of cases.
在NTP中,根据定义,Stratum 0是准确的时间源。 Stratum 1是一个使用Stratum 0时间源作为其时间源的系统(因此,其精度略低于Stratum 0时间源)。 同样,Stratum 2的精度略低于Stratum 1,因为它将时间与Stratum 1源同步,依此类推。 实际上,这种准确性的损失是如此之小,以至于在最极端的情况下几乎可以忽略不计。
Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.
有什么补充说明吗? 在评论中听起来不错。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程 。
翻译自: https://www.howtogeek.com/189836/how-do-ntp-servers-manage-to-stay-so-accurate/
ntp 服务器