2 Star 3 Fork 2

Gaaagaa / ntp_client

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

ntp_client

使用NTP协议获取网络时间戳,提供的 C/C++ 源码支持 Windows 和 Linux(CentOS) 两大平台。

1. Winodws 平台上编译与测试

系统需要安装并配置好 cmake 工具,命令行中执行如下命令:

mkdir build
cd build
cmake ..

然后进入 build 目录则可看到 sln 解决方案文件,使用 Visual Studio 打开,则可进行 编译/调试 等工作。

2. Linux 平台上编译与测试

mkdir build
cd build
cmake ..
make

依次执行上面的命令,即可看到编译结果。

3. 源码说明

核心代码(src 目录下):

  • xtypes.h : 定义通用数据类型的头文件。
  • xtime.hxtime.c :系统时间相关操作 API 与 相关数据定义 的 头文件 和 实现文件。
  • ntp_client.hntp_client.c :使用NTP协议获取网络时间戳所提供的 API 与 相关数据定义 的 头文件 和 实现文件。

测试程序代码(test 目录下):

  • xtime.c : xtime 主要接口的测试程序。
  • ntp_test.c : 使用 NTP 协议获取网络时间戳的测试程序。
The MIT License (MIT) Copyright (c) 2019, Gaaagaa All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

使用 NTP 协议获取网络时间戳。 展开 收起
C 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C
1
https://gitee.com/Gaaagaa/ntp_client.git
git@gitee.com:Gaaagaa/ntp_client.git
Gaaagaa
ntp_client
ntp_client
master

搜索帮助