How can the time differences between two Linux machine be measured accurately? I heard that 'Ping' gives RTT with the association of OS influences therefore not accurate in nanosecond level? If so, what else there have to measure the time difference (offsets) between two machines in Linux based system or Raspi?
This is my attempt to how do you measure the accuracy of a clock with no reference clock.
I chose a server - and said this is my reference - I made some , fairly small, effort to reduce or measure the changes in the "reference clock" - these changes in the end were to make its reference one clock and to record the jitter.
I then measured all other clocks offset from my designated reference I use NTP to do this as it makes an attempt to fix the measurement error of the time for the packet to traversing the network and, I believe, fix the error due to the processing time at both ends.
I probably should do some least squares analysis of all the offets or perhaps even look at how much the reference gets corrected by or the frequency it is running at - instead I just graph it , you might want to improve on that
So I had multiple NTP daemons on linux boxes (and windows , routers) these all synced to either the same or different time sources and I wanted to see what the errors were
To measure the differences I have one additional box with an NTP daemon which is setup to query each of the other boxes but NOT ever select them as a time source. I also set it to logging statistics and thus it logs the offset from itself to each of the servers at intervals
I selected one NTP server as this ones actual NTP server clock source to stabilize its clock frequency
This has produced graphs which at least showed me that Windows is very poor at keeping time , and that the other server did discipline the clocks and became more stable aver time.
This is only accurate to low tens of ms except windows which is 200ms of difference
My NTP config file on the monitor machine looks like
restrict default noquery nopeer nomodify notrap restrict -6 default noquery nopeer nomodify notrap restrict 127.0.0.1 restrict -6 ::1 driftfile "C:\Program Files (x86)\NTP\etc\ntp.drift" server time.windows.com enable stats statsdir "C:\Program Files (x86)\NTP\etc\" statistics loopstats peerstats server 184.108.40.206 noselect minpoll 6 maxpoll 6 server 220.127.116.11 noselect minpoll 6 maxpoll 6 server 18.104.22.168 noselect minpoll 6 maxpoll 6
i then end up with daily "peerstats" files in C:\Program Files (x86)\NTP\etc\ which have the servers and the offsets from the local machine - which I then insert into SQL and graph