[quagga-dev 5861] Re: Monotonic time, RFC

Joakim Tjernlund joakim.tjernlund at transmode.se
Tue Sep 2 14:42:34 BST 2008


On Tue, 2008-09-02 at 13:55 +0100, paul at clubi.ie wrote:
> On Tue, 2 Sep 2008, Joakim Tjernlund wrote:
> 
> > Well, I could not resist :) What do you think of this?
> > No more jumps for relative time.
> 
> How much does this matter? Let's just enable the CLOCK_MONOTONIC 
> code ;).

Perhaps, but somehow I got the feeling that you aren't going to enable
this any time soon and I am still unsure if CLOCK_MONOTONIC is
supported on older linux.

> 
> > +  relative_time.tv_sec += diff / clocks_per_sec; /* convert to seconds */
> > +  relative_time.tv_usec += ((diff % clocks_per_sec) * TIMER_SECOND_MICRO) / clocks_per_sec;
> > +  timeval_adjust (relative_time);
> 
> Ouch, this could hurt on weaker systems. You're much better off 
> taking the time to accurately work out (1/clocks_per_sec) *once*, so 
> that this often-called timer update function only has to do diff * 
> secs_per_clock.

hmm, don't quite follow. 1/clocks_per_sec is zero with integer math.




More information about the Quagga-dev mailing list