Re: Support for ``clock_gettime'' system call ?

Robert de Vries (rhdv@rhdv.cistron.nl)
Sat, 25 Sep 1999 14:12:07 +0200 (CEST)


On Fri, 24 Sep 1999 roussel@efi.com wrote:

>
> Hi,
>
> Is there any plan to support the ``clock_gettime'' system call
> and all its family (clock_settime, clock_getres) ?
>
> I know that gettimeofday and settimeofday, will provide equivalent
> functionnalities, but the POSIX.1b appeal of clock_gettime might
> be required, as well as the finer granularity, down to nano-seconds
> (even though such an accuracy is debatable as of today).

See http://www.rhdv.cistron.nl/posix.html for some of my patches regarding
this subject. As you can see in the patch for Linux 2.3.12 (the one with
the clock functions you are interested in), the clock functions do not yet
take advantage of the high resolution of the TSC clock of the pentium
processor, they just use gettimeofday and multiply the value with 1000.

However, it should be possible to improve the code for
do_fast_gettimeoffset() in arch/i386/kernel/time.c to return nanoseconds,
so that the POSIX function is somewhat more useful than it is now.

To do this you will need to change some code in calibrate_tsc(), which I
do not understand completely.
For instance why is CALIBRATE_TIME defined as (5 * 1000020/HZ)? Especially
the extra 20 confuses me.

And this is just for the i386 architecture, it needs changing for all the
others too.

So a nice job lies ahead for some brave soul....

Robert

-- 
Robert de Vries
rhdv@rhdv.cistron.nl

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/