Subject: Re: POSIX timer_settime() dosn't set timer in some cases (lost accuracy)
To: Jason Thorpe <>
From: Charles M. Hannum <>
List: tech-kern
Date: 09/02/2004 19:50:03
On Thursday 02 September 2004 15:10, Jason Thorpe wrote:
> On Sep 1, 2004, at 9:46 PM, Frederick Bruckman wrote:
> > On Wed, 1 Sep 2004, Jason Thorpe wrote:
> >> On Sep 1, 2004, at 7:41 PM, Frederick Bruckman wrote:
> >>> Now, hzto() takes great care to round up, but the nano-second is lost
> >>> before getting there in TIMESPEC_TO_TIMEVAL(). Should TS...TV always
> >>> round up? It seems, with the present state of affairs, that any
> >>> number
> >>> of timers in the kernel could be firing slightly too early. There's
> >>> no
> >>> harm, ever, in a timer firing nanoseconds late (or later), is there?
> >>
> >> Maybe if you're controlling spark plugs (well, ok, so you're not
> >> going to pop a hole in your piston if the timing is slightly
> >> retarded)... but, in any case, we're not, so no, I don't think
> >> there's any harm in it.
> >
> > Well, I'm running X and listening to streaming audio with this...
> I guess I should clarify... there may be times when you want "truncate"
> and times when you want "round".  Perhaps we need a TS_TO_TV macro for
> each.

For example, it's probably better to truncate file time stamps, so that 
comparing with the current time works as expected.

For internal time, though, we should really be using nanoseconds or better.