[time-nuts] Clock Correction Algorithm

Miguel Gonçalves mail at miguelgoncalves.com
Thu Nov 24 12:56:31 UTC 2011


On 24/11/2011, at 11:42, Attila Kinali <attila at kinali.ch> wrote:

> On Thu, 24 Nov 2011 10:14:17 +0000
> Miguel Gonçalves <mail at miguelgoncalves.com> wrote:
> 
>> The clock is set by sending an NTP packet and setting the clock with the
>> replied timestamp plus half of the round trip time. In a local LAN this
>> seems a good solution. I am not after micro-second accuracy as this is a
>> clock and our eyes don't recognize anything faster than 50 ms. Even then I
>> am aiming for 1-10 ms maximum offset with the NTP server.
> 
> if you want to be better than 10ms, you can just use the value you
> get from the NTP server, raw, without any processing. The usuall
> RTT values in a LAN (light or moderate load) is around 100-200us.
> Ie if your NTP server doesn't take an exuberant amount of time
> to respond (which it should not anyways) and your LAN is not heavily
> loaded, you will be below 1ms in 99% of the time.

Right! That is what I am doing.

The problem is the drift between adjustments. Arduino's clock is slow 25 ms every minute and if temperature changes it will surely be different. 

The proposed algorithm wants to correct that. 

Cheers,
Miguel




More information about the Time-nuts_lists.febo.com mailing list