Java NTP客户端 [英] Java NTP client

查看:138
本文介绍了Java NTP客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要我的软件与NTP服务器通信以确定本地时钟偏移。我尝试过使用org.apache.commons.net.ntp软件包,但是在Windows上运行时它的实现相当差,因为使用System.currentTimeMillis()来确定NTP数据包交换之前和之后的时间。您可能知道或者可能不知道,只有在系统时钟滴答时才会更新此值,大多数现代Win2k3服务器都是64Hz或每15.625ms。这极大地限制了时钟偏移计算的准确性。

I need my software to communicate with an NTP server to determine the local clock offset. I have tried using the org.apache.commons.net.ntp package, but its implementation is rather poor when running on Windows, because of the use of System.currentTimeMillis() to determine the time before and after the NTP packet exchange. As you may or may not know, this value is only updated when the system clock ticks, which on most modern Win2k3 servers is at 64Hz or every 15.625ms. This greatly limits the accuracy of the clock offset calculation.

Ntpd使用CPU高频定时器在系统时钟周期之间进行插值,并实现更高的分辨率时间。您是否知道使用此技术或类似技术的Java实现?或者您知道除Apache之外的任何其他NTP实现吗?

Ntpd uses the CPU high-frequency timer to interpolate between system clock ticks, and achieve much higher resolution time. Do you know of a Java implementation that uses this or a similar technique? Or do you know of any other NTP implementation other than Apache's?

推荐答案

support.ntp.org

这篇关于Java NTP客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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