开发者

NTP Client using the Windows API

开发者 https://www.devze.com 2023-01-09 22:01 出处:网络
I\'m maintaining a legacy system (pre .NET).Is there any way to fetch the time from an NTP server using the Windows A开发者_开发技巧PI?Failing that, I could probably create a COM object with .NET to d

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


Yes, it's certainly possible. Unless you're quite ambitious, it's probably easiest to start from working source code. I'd go for Terje Mathisen's port, but that's probably because I've known Terje via Usenet (comp.lang.asm.x86) for years -- the other ports are probably perfectly good too.


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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号