SDL/src
Sam Lantinga 72ab258812 Fixed bug 2764 - Timer is not rescheduled with the returned interval
afwlehmann

Sorry for re-opening, but it turns out that the current interval is indeed not updated. I've just checked the source code of the 2.0.3 release again:

   163	    if (current->canceled) {
   164	        interval = 0;
   165	    } else {
   166	        interval = current->callback(current->interval, current->param);
   167	    }
   168
   169	    if (interval > 0) {
   170	        /* Reschedule this timer */
   171	        current->interval = interval; // <-- this line is missing
   172	        current->scheduled = tick + interval;
   173	        SDL_AddTimerInternal(data, current);
   174	    } else {

According to the documentation: "The callback function is passed the current timer interval and the user supplied parameter from the SDL_AddTimer() call and returns the next timer interval. If the returned value from the callback is 0, the timer is canceled."

If I understand the text correctly, then the current interval should in fact be updated according to the returned value. Otherwise there would be a discrepancy between the next time for which the timer is actually re-scheduled and the value that's passed to the callback once the timer fires again.

This could be fixed by adding line #171.
2017-08-13 21:48:40 -07:00
..
atomic atomic: Patched to compile on Android. 2017-04-13 15:28:56 -04:00
audio Fixed bug 3702 - Clear error messages of SDL_LoadObject for optional libraries 2017-08-11 10:21:19 -07:00
core Provide the correct state of the on-screen keyboard to the API (patch from Sylvain) 2017-08-13 21:05:15 -07:00
cpuinfo Fixed compile error with gcc -std=c99 2017-03-06 21:25:06 -08:00
dynapi Added SDL_wcscmp() 2017-08-13 20:37:49 -07:00
events Fixed bug 3744 - missing SDLCALL in several functions 2017-08-13 21:06:52 -07:00
file Fixed compiler warnings on Visual Studio 2013 2017-08-12 00:04:46 -07:00
filesystem Fixed bug 3639 - SDL_GetPrefPath returns a path with two consecutive slashes on Unix if org is omitted 2017-08-11 11:32:00 -07:00
haptic Fixed bug 3191 - haptic system on android? 2017-08-12 08:15:09 -07:00
joystick Fixed bug 3744 - missing SDLCALL in several functions 2017-08-13 21:06:52 -07:00
libm Updated copyright for 2017 2017-01-01 18:33:28 -08:00
loadso Updated copyright for 2017 2017-01-01 18:33:28 -08:00
main Fixed bug 2812 - Make libSDL2main.a usable on Android via a dummy symbol 2017-08-13 18:12:06 -07:00
power power: whoops, that should be "==" not "!=". 2017-07-03 16:45:12 -04:00
render Fixed bug 3744 - missing SDLCALL in several functions 2017-08-13 21:06:52 -07:00
stdlib Added SDL_wcscmp() 2017-08-13 20:37:49 -07:00
test Added test debug logs for additional event types 2017-08-12 20:21:34 -07:00
thread Fixed bug 3258 - SDL_TryLockMutex blocks for pthreads with FAKE_RECURSIVE_MUTEX 2017-08-11 21:47:31 -07:00
timer Fixed bug 2764 - Timer is not rescheduled with the returned interval 2017-08-13 21:48:40 -07:00
video Fixed bug 3742 - minor warning fixes 2017-08-13 21:16:58 -07:00
SDL_assert_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_assert.c Fixed bug 3744 - missing SDLCALL in several functions 2017-08-13 21:06:52 -07:00
SDL_dataqueue.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_dataqueue.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_error_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_error.c Fixed bug 3696 - SDL_ShowMessageBox displays different error from intended 2017-07-10 17:16:12 -07:00
SDL_hints.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_internal.h Some patches to make SDL compile with armcc (ARM's C compiler). 2017-03-02 13:33:04 -05:00
SDL_log.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL.c Backing out broken change from previous commit. 2017-04-01 00:46:42 -04:00