git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@375
7f0cb862-5218-0410-a997-
914c9d46530a
static long fgNextTimer( void )
{
long ret = INT_MAX;
- SFG_Timer *timer;
+ SFG_Timer *timer = fgState.Timers.First;
- if( (timer = fgState.Timers.First) )
+ if( timer )
ret = timer->TriggerTime - fgElapsedTime();
+ if( ret < 0 )
+ ret = 0;
return ret;
}
msec = fgNextTimer( );
if( fgHaveJoystick( ) )
msec = MIN( msec, 10 );
-
+
wait.tv_sec = msec / 1000;
wait.tv_usec = (msec % 1000) * 1000;
err = select( socket+1, &fdset, NULL, NULL, &wait );