tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: PSA: Clock drift and pkgin



mouse%Rodents-Montreal.ORG@localhost (Mouse) writes:

>        } else if (sec <= (LONG_MAX / 1000000))
>                ticks = (((sec * 1000000) + (unsigned long)usec + (tick - 1))
>                    / tick) + 1;

>which looks suspicious.  If sec is zero and usec is tick, that
>expression will return 2 instead of the 1 I suspect it needs to return.


The delay is always rounded up to the resolution of the clock,
so waiting for 1 microsecond waits at least 10ms.

The interval to the next tick can be arbitrarily short. Waiting
for at least 10ms therefore means to wait for the second next
tick.

In a tickless system, such a problem doesn't exist.



Home | Main Index | Thread Index | Old Index