[SDL] Timer accuracy

Latimerius pvl at uh.cz
Mon Sep 16 08:22:01 PDT 2002


On Mon, Sep 16, 2002 at 04:37:42PM +0200, David Olofson wrote:

> On Monday 16 September 2002 12:35, Latimerius wrote:
> > On Mon, Sep 16, 2002 at 10:20:47AM +0200, David Olofson wrote:
> > > However, very few operating systems support timers that can wake up
> > > threads, send signals or something like that, with better than 10 ms
> > > accuracy. This is because of OS scheduler design, and on some
> > > platforms, there isn't much to do about it. The scheduler checks
> > > software timers at 100 Hz, and that's it.
> >
> > Won't rising of HZ in the Linux kernel help timer accuracy?
> 
> Well, it *should* increase the resolution of "wake up/signal" style 
> timers, but as gettimeofday() normally uses the TSC when available, 
> that's still theoretically accurate down to the ns range. (Not sure what 
> accuracy the interface actually allows.)

The interface allows for microseconds iirc (struct timeval::tv_usec) and
at least on Linux/i386 microsecond resolution is actually used.  But is
gettimeofday() useful for timers?

	latimerius





More information about the SDL mailing list