是否有任何C / C ++库与远程NTP服务器连接? [英] Is there any C/C++ library to connect with a remote NTP server?
问题描述
我正在制作一个需要与远程NTP服务器同步系统时钟的C ++软件。
现在,我使用system命令来调用控制台ntpdate命令。
I'm making a C++ software that needs to syncronize system clock with remote NTP server. For now, I'm ussing "system" command to call the console "ntpdate" command.
..但我认为是一种丑陋的方式
..But I think is an ugly way to do that.
你知道任何让我连接到远程NTP服务器的库吗?
感谢。
Do you know any library that let me connect to remote NTP server? Thanks.
推荐答案
这不是一个更好的解决方案,只是有ntpd运行在所述系统上,正确,而不是让您的软件手动发出同步,并可能导致其他应用程序不会遇到突然的时间跳跃,特别是向后的问题。
Would it not be a better solution to just have ntpd running on said system to ensure clock being correct instead of having your software manually issuing a sync and possibly causing issues with other applications not enjoying sudden time jumps, especially backwards.
这是说有libntp我相信。
That being said there is libntp I believe.
Google会为我寻找更多内容。
C ++中的NTP客户端
I'll drop in more things as Google finds them for me. NTP Client in C++
这篇关于是否有任何C / C ++库与远程NTP服务器连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!