time.h design issues

Ulrich Drepper drepper at cygnus.com
Sun Aug 29 16:56:37 UTC 1999


Paul Eggert <eggert at twinsun.com> writes:

> I agree that my proposed API is still too complicated.  When I get the
> time I'll try to simplify it.  Your code is a valuable resource in
> this area: implementation experience counts for a lot in my book.

Well, then I hope you suggest an implementation for a monotonic time
implementation.  Constraints are:

  The underlying OS will not notify each running program about a sudden
  clock change and itself does not provide a monotonic clock.

In this situation the only thing you can count on are some hardware
"clocks" the kernel does not (or cannot) influence.  I think about
things like the time stamp counters found on many modern processors.
But:

- they are only found on modern processors, and therefore a generic
  implementation isn't possible

- even if they are available, they might be useless if, as in the case
  of the Alpha, the counter range is too small (just do the math: a 32 bit
  counter increment in each clock cycle on machines with, as seen two weeks
  ago, 1GHz clock speed).


What I meant to say is think about the implementation before you
propose something.  It is certainly nice to have such a timer but it
is very often not possible to implement it and for exactly this reason
we have adjtime().

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------



More information about the tz mailing list