This is a C++ class that implements a NTP client. It has been tested with a chrony server. I have also included a sample of my chrony.conf file where I have setup a local server and client for my experiments.
First create an empty directory inside your working folder:
mkdir build && cd build
and then
cmake ..
and
cmake --build .
Optional, if you want to install:
make install DESTDIR={YOUR_INSTALLATION_PATH}
By default, the installation path is /usr/local/
Part of the code has been based to C NTPClient by David Lettier
- UDP Server-Client implementation in C
- Let's make a NTP Client in C
- Technical information - NTP Data Packet
- Ubuntu Bionic: Using chrony to configure NTP (which works for Xenial as well)
- rosbee - chrony.wiki