3 ms·
For a project I was working I needed to synchronize clocks with extremely high precision (though accuracy was less important, and it was masterless so there was
by rkeene2 7y ago
For a project I was working I needed to synchronize clocks with extremely high precision (though accuracy was less important, and it was masterless so there was no authority) similar to PTP and I created the following simple system:
1. Server: Connect over TCP. For every byte sent, responds back with that system's time in microsceonds.
2. Client: Select a few peers, one at a time: connect over TCP, send a byte and note the round-trip time, halve it to get an approximation of the timepoint that the value was sent to you at, compute delta from current system clock; repeat 20 times, discard first 5 values; exclude outliers (+/- 1 standard deviation) and average to compute the offset, then repeat for the next host, etc until you get some change to make
It worked out and kept the required precision among the collection of nodes required for Ceph to work well.