使用 Windows API 的 NTP 客户端 [英] NTP Client using the Windows API

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

问题描述

我正在维护一个遗留系统(.NET 之前).有没有办法使用 Windows API 从 NTP 服务器获取时间?如果做不到这一点,我可能可以使用 .NET 创建一个 COM 对象来完成它,但我宁愿不这样做.

I'm maintaining a legacy system (pre .NET). Is there any way to fetch the time from an NTP server using the Windows API? Failing that, I could probably create a COM object with .NET to do it, but I would rather not go to that effort.

推荐答案

我发现的最佳来源是 http://www.dataman.ro/?page_id=39.

The best source that I found was http://www.dataman.ro/?page_id=39.

但是,我倾向于使用本地 LAN/WAN 上服务器的时间,通过 NetRemoteTOD.只要在本地时间服务器机器上正确配置,Windows 应该自动保持与 NTP 服务器同步的日期.然后,如果他们的 Internet 访问中断,我仍然可以获取标准"时间.

However, I'm leaning toward using the time from a server on the local LAN/WAN, via NetRemoteTOD. Windows is supposed to keep the date synchronized from an NTP server automatically, as long as its configured properly on their local time server machine. Then if their Internet access goes down, I'll still be able to fetch the "standard" time.

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

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