[SDL] Why not nanosleep()?

Garrett mongoose at WPI.EDU
Mon Apr 3 21:53:11 PDT 2000


  Linux has an internel timer resolution of 10Hz. The most accurate you can set
a timer for in linux is 1/100th of a second. nanosecond is pointless since you
will never get nanosecond accuracy. Im not sure about other OS's but I would
guess that you wouldn't get nanosecond accuracy on them either. Also select is
the most portable timer. I think even windows supports it.

On Mon, 03 Apr 2000, you wrote:
> Maxim Sobolev wrote:
> > 
> > Hi,
> > 
> > I'm wondering why the SDL library doesn't use POSIX conformant nanosleep()
> > function in its SDL_Delay() routine. Currently select() used for this purpose,
> > which IMHO looks like hammering nails using computer keyboard...
> > 
> > I have patches at hand, so it someone will want to commit them please let me
> > know.
> > 
> 
> nanosleep(2) is a POSIX.1b feature.  Linux doesn't completely support
> POSIX.1b, and neither does any version of Windows I have used (know
> nothing about W2K, though).  If it doesn't exist on all platforms, then
> it's trouble for portability.
> 
> -- 
> ------------------------------------------------------------------------
> | Rafael R. Sevilla                                dido at pacific.net.ph |
> |           Instrumentation, Robotics, and Control Laboratory          |
> |    College of Engineering, University of the Philippines, Diliman    |
> ------------------------------------------------------------------------
-- 
-Garrett,  WPI student majoring in Computer Science
"The fastest way to succeed is to look as if you're playing by somebody
else's rules, while quietly playing by your own." -Michael Konda



More information about the SDL mailing list