I'm facing an issue with getting my NTP Client (Running on Ubuntu) to have it's time sync to a NTP Server (running on windows) to millisecond precision.
The NTP Server runs using an open source python module: https://github.com/limifly/ntpserver
The NTP Client has server 192.168.0.28 prefer iburst
in the ntp.conf file.
I found that the client requests for the time every 2 - 15 seconds.
To check the time I have a simple python script running on both devices and I'll do a screen shot with both print outs displaying:
from datetime import datetime
def main():
while True:
try:
print datetime.utcnow().strftime("%Y-%m-%d_%H-%M-%S.%f")
except KeyboardInterrupt:
print "Exiting..."
break
if __name__ == '__main__':
main()
I am getting deviations of 5 seconds to 100 milliseconds.
When I run the command:
sudo service ntp stop
sudo ntpdate -s [NTP SERVER ADDRESS]
sudo service ntp start
I found that I can get 70 milliseconds to 5 microseconds precision immediately. After about 5 minutes I can see that the time deviates by 7 seconds...
My goal is to get millisecond precision so my question is am I doing everything correctly to achieve this goal? Also is there a better way to measure the time sync time?