Re: clockspeed issues on NetBSD/sparc64

[email protected] (Paul Jarc) Thu, 27 May 2004 10:20:17 -0400
Newsgroups gmane.comp.lib.libtai
Organization What did you have in mind? A short, blunt, human pyramid?
Message-ID <[email protected]>
Sean Davis <[email protected]> wrote:
> ./compile leapsecs_read.c
> leapsecs_read.c: In function `leapsecs_read':
> leapsecs_read.c:32: warning: cast to pointer from integer of different size

Better add "#include <stdlib.h>" at the top to be safe.

> I looked at where it bombed first in clockspeed.c, and it appears to
> be dying because it doesn't have RDTSC or GETHR. This makes sense; I'm
> guessing GETHR is what it uses on non-i386 platforms, if available?

Yep.  BLURB:
# This version of clockspeed can use the Pentium RDTSC tick counter or the
# Solaris gethrtime() nanosecond counter.

> In any case, clockspeed.c won't build - so my original plan of getting
> clockspeed adjusted properly on the i386 machine and running taiclockd
> to sync the Ultra won't work.

Well, you can't use clockspeed on the Ultra (at least not without some
significant knowlege and patching).  But you can use it on your
Pentium machine (i386 isn't sufficient) and run taiclockd there.  Then
the remaining problem is that you need something on the Ultra that can
take the output from taiclock and apply it to the system clock with
adjtime.  It ought to be simple enough to trim clockspeed.c down until
it does just that; maybe someone's done it already.

What you lose, in that situation, is a good clock even when you
haven't done an adjustment from the other system in a while.  Your
drift won't be corrected until the next input.  clockspeed would
remember how skewed your system clock is, and constantly adjust it to
compensate, even without ongoing inputs.  But I think it ought to be
possible to tweak clockspeed so it doesn't need the hardware clock at
all - it could calculate the skew based on the input adjustments.
This would be less precise, but hopefully still precise enough to be
useful.  Maybe someone's already done that too.

> Or, should I edit the Makefile/source so that it compiles everything
> but clockspeed, and do it that way? (I know modifying the source is
> generally discouraged; this is why I'm looking for other ideas.)

If you don't need clockspeed itself on that machine, you could do
"make -k" if you make supports that, or "touch clockspeed.o;
touch clockspeed; make"


paul