[ntp:questions] Re: time

Richard B. Gilbert rgilbert88 at comcast.net
Fri Dec 2 22:02:18 UTC 2005


K wrote:

>>The accuracy obtainable depends on:
>>a. the utilization level of the LAN (how congested it is).
>>    
>>
>at times 70-80%  but sporadic.
>  
>
>>b. the LAN hubs or switches in use
>>    
>>
>All Cisco stuff model 6500 or better
>  
>
>>c. the hardware the server runs on
>>    
>>
>truetime, semtriccom,  one of the big time device servers.
>  
>
>>d. the quality of the time source(s) used by the server (This, in turn, 
>>may depend on the quality of the internet                connection)
>>    
>>
>From a GPS antenna
>  
>
>>e. the O/S used on the server
>>    
>>
>unknown, probably linux :-)
>  
>
>>f.. the hardware the client systems run on
>>    
>>
>opteron stuff
>  
>
>>g. the O/S running on the client systems.
>>    
>>
>linux  kernel version 2.6, I think compiled to a event granularity of 1 ms. 
>Windows, and a lot of the other ones are at 10 ms.
>  
>
>>h. the version of ntpd in use
>>    
>>
>probably version 3.x since the standard is finalized.
>
>
>Can I get below the granularity of the events of my operating system?  Since 
>the jitter of when the NTP client would run would make this difficult to 
>predict?
>
>
>
>  
>
If the "event granularity" you refer to is set by the kernel parameter 
HZ,  you probably do not want it set to 1000 or 1 millisecond 
granularity.   That requires the system to service a clock interrupt 
1000 times per second and can cause problems with lost clock interrupts.

Some operating systems, Solaris among them, can interpolate between 
clock ticks and measure intervals as small as one microsecond. 

A program such as the following should demonstrate the capabilities of 
your system in this regard.

/*****************************************************************************
* FILE: gettime.ex.c
* DESCRIPTION: Demonstrates use of the gettimeofday function
* LAST REVISED: 01/09/96 Blaise Barney
*****************************************************************************/

#include <stdio.h>
#include <sys/time.h>
#include <time.h>
#define ARRAY_SIZE      1000
#define SEED            1995

float a[ARRAY_SIZE][ARRAY_SIZE];
float b[ARRAY_SIZE][ARRAY_SIZE];
float c[ARRAY_SIZE][ARRAY_SIZE];
struct timeval start_time, end_time;

main()
{
   int i, j;
   int total_usecs;

   /* First, call gettimeofday() to get start time */
   gettimeofday(&start_time, (struct timeval*)0);

    for(i=0;i<1000;i++)
       for(j=0;j<1000;j++)
          c[i][j] = c[i][j] + a[i][j] * b[i][j];

   /* Now call gettimeofday() to get end time */
   gettimeofday(&end_time, (struct timeval*)0);  /* after time */

   /* Print the execution time */
   total_usecs = (end_time.tv_sec-start_time.tv_sec) * 1000000 +
                 (end_time.tv_usec-start_time.tv_usec);

   printf("Total time was %d uSec.\n", total_usecs);
}

If you comment out the double for loop the program will report the
time elapsed between two consecutive calls to gettimeofday.  On one of
my Sun Ultra 10 (440 MHz processor) workstations I found this interval
to be either one or two microseconds for several executions.

The smallest possible value is the "precision" of your clock.  The
"accuracy" is the difference between the absolute time reported and
the true value of UTC.

The accuracy of your Symmetricom GPS should be specified for the device.
I would expect it to be in the range of 25 to 100 nanoseconds.  You can
use the npttime command to get an estimate of the accuracy with which
each client keeps time.





More information about the questions mailing list