Until now the fraction of the second was not taken into account. Therefore the resulting time offset is up to 1000 ms. Using the provided Information increases the accuracy of the synchronization to 20-30 milliseconds. And it requires just two lines of code.
https://imgur.com/a/aVjvHON
In this plot both methods are compared. Plotted is the time difference in respect to a PPS signal provided by a GPS receiver. For comparison the time was synchronized over 1000 times and the resulting time difference filled into the respective histogram.
The NTPClient method update() has been changed to only return "TRUE" after a successful update. The following conditions return "FALSE":
- Interval duration requirement not met
- forceUpdate() times out
I added two functions:
```cpp
setTimeOffset(int timeOffset)
```
Allows you to set the offset at a later stage (e.g. upon timezone
changes or change from summertime to standard time)
```cpp
setUpdateInterval(int updateInterval)
```
Allows to set the interval at a later point. This was helpful when not
setting an offset at initialization and e.g. for other sync times during
special occasions.