[ntp:questions] Time synchronization

Hans Jørgen Jakobsen hjj at wheel.dk
Sat Feb 21 21:20:52 UTC 2009

On 21 Feb 2009 12:15:30 GMT, Rob wrote:
> I think the value returned by the gettimeofday function will probably
> have a worse resolution on the MOXA board than it has on the PC.
> That will make it difficult to get a low offset value, as the gpsd process
> sends the gettimeofday value at the time of the PPS pulse to ntpd via
> the shared memory block.  That is how the shared memory (SHM) interface
> works.  When the gettimeofday on the MOXA board only returns values with
> a 10ms or 20ms resolution, the jitter value will be high and the offset
> will never be very low.
> On the PC platform, various methods are used to get a very good resolution
> on the gettimeofday function.  The chips on your board may not have that
> information available.
> You could compile a simple test program like this:
> #include <stdio.h>
> #include <sys/time.h>
> main ()
> {
>     struct timeval t;
>     int i;
>     for (i = 0;i < 25;i++)
>     {
>         gettimeofday(&t,NULL);
>         printf("  %ld.%06ld\n",t.tv_sec,t.tv_usec);
>     }
> }
> Then run it.  Try it on your different boards.  You will see if there
> is some big increment in the printed value, ideally you should see only
> small steps in the last digit.

Be aware of clocks simulating a real clock that is always incrementing
by making some pseudo increments between the real increments.

More information about the questions mailing list