通过互联网同步时钟
我使用我自己的协议通过互联网在两台专用计算机之间发送实时关键数据。
当然,这涉及到延迟。
为了调试和优化,我喜欢让两台计算机使用相同的时基。 即,我需要知道他们时钟的时差,以便我可以更好地判断延迟。
当然,相对主义之类的东西并不能真正让我完美地同步它们,但我喜欢尽可能接近。
仅依靠 NTP 似乎还不够好 - 根据我的经验,时钟可能会偏差半秒(澄清:到目前为止我依赖 Apple 提供的默认时钟)。
我至少需要 1/10 秒范围内的精度。 两台计算机之间的距离不会太远,ICMP ping 时间通常小于 100 毫秒。
有什么建议如何做到这一点?
(目前,涉及的机器运行 OS X,所以如果您知道适合它们的解决方案,那就是一个开始)
I am sending real-time-critical data over the internet between two dedicated computers, using my own protocol.
There is, of course, latency involved.
For debugging and optimization, I like to have both computers use the same timebase. I.e, I need to know the time difference of their clocks so that I can judge the latencies better.
Of course, relativism and such doesn't really allow me to sync them perfectly, but I like to get as close as possible.
Relying on NTP alone does not appear good enough - clocks can be off by half a second in my experience (clarification: I relied so far on the default one provided by Apple).
I need precision in the 1/10s range, at least. The two computers won't be too far apart, ICMP ping times are less than 100ms, usually.
Any suggestions how to do this?
(currently, the machines involved run OS X, so if you know a solution just for them, that'll be a start)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
从连接到机器的 GPS 接收器获取时间。 不幸的是,如果它们位于数据中心,则可能很难将天线放置到可以锁定的位置。
Get the time from a GPS receiver connected to the machines. If they are in a data centre it can be difficult getting an antenna into a location that it can get a lock though unfortunately.
我建议您最好的选择是在其中一台计算机上安装 ntp 服务器,然后让另一台计算机与其同步。
I would suggest that your best bet is to install an ntp server on one of the machines and get the other to sync to it.
您是否尝试过将其中一台机器作为另一台机器的 NTP 服务器? 也许它们不会与“实时”时间同步,但这可能会让您达到所需的精度。
Did you try to have one of the machine as NTP server for the other? May be they won't be in sync with the 'real' time but this may bring you within the precision you require.
真奇怪。 Internet 上的 NTPd 应该可以为您提供更高的精度。
That's strange. NTPd over Internet is supposed to give you much greater precision.