[ntp:questions] Re: Linux PPS triggering with NMEA

Per Hedeland per at hedeland.org
Tue May 10 06:15:31 UTC 2005


In article <m3acn4ozpe.fsf at lysator.liu.se> Bjorn Gabrielsson
<bg at lysator.liu.se> writes:
>
>I know what TIOCMIWAIT gives. Is there a user-space function that can
>return time with better than than the 1us resolution that
>gettimeofday() gives?

To answer your question in the literal sense, "there is" the function
clock_gettime(), that *can* return time with 1 ns resolution (through a
struct timespec rather than struct timeval). What it actually does do
(assuming that it is present) on some particular combination of Linux
kernel and C library/ies, or any other OS for that matter, I won't
speculate on - it would be perfectly valid for an implementation to just
be a wrapper around gettimeofday(). But you should be able to find out
the actual resolution via clock_getres().

--Per Hedeland
per at hedeland.org




More information about the questions mailing list