[ntp:questions] Re: program to test actual resolution of Linux?

Ulrich Windl Ulrich.Windl at RZ.Uni-Regensburg.DE
Tue Sep 9 14:35:05 UTC 2003


ryandrk at hotmail.com (Drk Ryan) writes:

> >>>But Windows provides a function, GetSystemTimeAsFileTime(), that
> >>>allows you to query the system time in 100 nanosecond intervals. 
>  
> >>What you mean is that the function returns time with a theoretical
> >>resolution of 100ns. However it would appear likely that the actual
> >>times returned have a resolution of 10ms.  [rearranged slightly]
> >>Write a program that busy loop calls this function and saves the results
> >>over say 1000 calls.
> 
> >I wrote a program that retrieved 10,000 unique values from the
> >GetSystemTimeAsFileTime() function, then analyzed the delta between
> >consecutive times. Out of 9,999 deltas, 9,974 of them were 10.144
> >milliseconds. 
> 
> Does anyone have code available to do this for Linux?

Drk,

call gettimeofday() twice and subtract. If you won't believe in the
method, describe what you are expecting as result.

Regards,
Ulrich

P.S: If you are lazy:
ntpq> rl
status=06f4 leap_none, sync_ntp, 15 events, event_peer/strat_chg,
version="ntpd 4.1.1 at 1.786 Tue Feb  4 16:39:46 UTC 2003 (1)",
processor="i586", system="Linux2.4.19-4GB", leap=00, stratum=2,
precision=-18, rootdelay=44.226, rootdispersion=275.741, peer=23695,
refid=lanczos.maths.tcd.ie,
reftime=c30861df.02caab8a  Tue, Sep  9 2003 16:27:43.010, poll=7,
clock=c308624c.95697f1f  Tue, Sep  9 2003 16:29:32.583, state=4,
offset=23.011, frequency=-15.395, jitter=15.000, stability=25.487

Precision means 2^-18 seconds...



More information about the questions mailing list