[lkml]   [1999]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Support for ``clock_gettime'' system call ?
On Fri, 24 Sep 1999 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 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 de Vries

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:54    [W:0.028 / U:1.440 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site