通过互联网同步时钟

发布于 2024-07-14 14:45:19 字数 399 浏览 11 评论 0原文

我使用我自己的协议通过互联网在两台专用计算机之间发送实时关键数据。

当然,这涉及到延迟。

为了调试和优化,我喜欢让两台计算机使用相同的时基。 即,我需要知道他们时钟的时差,以便我可以更好地判断延迟。

当然,相对主义之类的东西并不能真正让我完美地同步它们,但我喜欢尽可能接近。

仅依靠 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

梦屿孤独相伴 2024-07-21 14:45:19

从连接到机器的 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.

黎夕旧梦 2024-07-21 14:45:19

我建议您最好的选择是在其中一台计算机上安装 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.

拥抱影子 2024-07-21 14:45:19

您是否尝试过将其中一台机器作为另一台机器的 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.

沩ん囻菔务 2024-07-21 14:45:19

单独依靠NTP不会出现
足够好 - 时钟可以关闭
根据我的经验,半秒。

真奇怪。 Internet 上的 NTPd 应该可以为您提供更高的精度。

Relying on NTP alone does not appear
good enough - clocks can be off by
half a second in my experience.

That's strange. NTPd over Internet is supposed to give you much greater precision.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文