#155 glutTimerFunc does not detect if system time moved backward

closed-fixed
nobody
moderate (59)
5
2012-11-20
2011-09-23
Anonymous
No

If the system time moves backward, the glut event loop will wait too long before triggering timer callbacks. It will wait until the system time catches up to what it was before and then some.

There are 2 possible solutions:

- Before sleeping in the main event loop, detect that the amount of time until the expiry if a timer is more than the originally scheduled delay. This approach is used by the glib event loop but it requires that the originally scheduled delay be stored in the timer object, which freeglut does not currently do.

- Use clock_gettime(CLOCK_MONOTONIC) instead of gettimeofday() to obtain the system time, because the former is guaranteed not to jump backward.

A patch is attached which implements the second solution, if it is available.

-Phil

Discussion

  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2011-09-23

    patch to use clock_gettime(CLOCK_MONOTONIC) if available

     
  • John F. Fay

    John F. Fay - 2012-02-25
    • status: open --> open-fixed
     
  • John F. Fay

    John F. Fay - 2012-02-25

    Done

     
  • Diederick C. Niehorster

    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks