On Thu, Dec 13, 2018 at 09:27:12PM +0000, Paul Swanson wrote:
> Hi,
>
> I'm trying to understand how interval timers work in OpenBSD,
> but I'm a little stuck on this line from the getitimer / setitimer man page:
>
> "Time values smaller than the resolution of the system clock
> are rounded up to this resolution (typically 10 milliseconds)."
>
> Does this mean that 10 milliseconds is the shortest interval possible
> with a system interval timer?
>
> If so, are there other userland options for more precise timers?
>
What would need a more precise timer? with what resolution?
On amd64, you could build a kernel with HZ=1024, which gives a timer
that ticks every 1ms. I use this since ~2005 for MIDI programs.
If the program that needs a precise timer involves audio, you could
also use the sound card clock instead. For instance by running sndiod
with "-z 120" option then call your code in the sio_onmove(3)
call-back. The advantage of this approach is that you get a unique
clock source, which avoids may problems.
No comments:
Post a Comment