Simple Directmedia Layer
Go to file
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
acinclude Fixed bug 3481 - Configure fails to detect dynamic library support on powerpc64le 2016-11-06 20:26:48 -08:00
android-project Provide the correct state of the on-screen keyboard to the API (patch from Sylvain) 2017-08-13 21:05:15 -07:00
build-scripts Fixed bug 2839 - No way to create pre-built libraries for Android 2017-08-13 17:59:59 -07:00
cmake cmake: whoops, Sam and I both fixed this bug at the same time. :) 2017-08-09 22:34:45 -04:00
debian We don't actually build with the Xt library 2017-01-10 23:23:32 -08:00
docs README-linux.md: added libsndio-dev to the package list. 2017-08-07 00:36:45 -04:00
include Added SDL_wcscmp() 2017-08-13 20:37:49 -07:00
src Fixed bug 2764 - Timer is not rescheduled with the returned interval 2017-08-13 21:48:40 -07:00
test Fixed bug 3743 - make testautomation_sdltest.c to compile 2017-08-13 21:18:59 -07:00
VisualC Updated Visual Studio 2008 project 2017-07-10 15:55:13 -07:00
VisualC-WinRT WinRT: removed Windows 8.0 from build-bot + NuGet package creation scripts 2017-02-25 21:23:12 -05:00
visualtest Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Xcode Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Xcode-iOS ios: Fixed math include in demos. 2017-05-25 23:01:59 +02:00
.hgignore wayland: Build own version of core protocol 2016-06-23 18:39:05 +08:00
Android.mk Fixed bug 2839 - No way to create pre-built libraries for Android 2017-08-13 17:59:59 -07:00
autogen.sh Don't use pushd/popd in autogen.sh; Ubuntu's /bin/sh doesn't support it. 2016-12-26 22:58:58 -05:00
BUGS.txt BUGS.txt: Changed mailing list link to discourse.libsdl.org. 2017-04-01 00:05:25 -04:00
cmake_uninstall.cmake.in Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
CMakeLists.txt Added SDL_wcscmp() 2017-08-13 20:37:49 -07:00
configure Added SDL_wcscmp() 2017-08-13 20:37:49 -07:00
configure.in Added SDL_wcscmp() 2017-08-13 20:37:49 -07:00
COPYING.txt Updated copyright for 2017 2017-01-01 18:33:28 -08:00
CREDITS.txt Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
INSTALL.txt More HTTPS doc tweaks. 2017-02-16 16:59:07 -05:00
Makefile.in Fixed bug 3208 - Minor improvements to the configure script 2017-08-12 15:00:33 -07:00
Makefile.minimal Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
Makefile.pandora pandora: Fixed compiler warning about redefining SDL_REVISION. 2017-06-18 23:00:27 +02:00
Makefile.psp PSP: Added missing object for generic TLS to Makefile. 2016-02-13 17:34:14 +01:00
Makefile.wiz Pandora: Updated SDL version in Makefile. 2016-07-19 21:01:30 +02:00
README-SDL.txt More HTTPS changes in the documentation. 2017-02-16 16:52:03 -05:00
README.txt readme: correct webpage URL to use HTTPS. 2017-02-16 13:30:34 -05:00
sdl2-config.cmake.in Applied Ubuntu patch bug_822210_fix_sdl2-config.cmake_whitespace.patch 2016-10-07 15:08:37 -07:00
sdl2-config.in Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
sdl2.m4 Fixed bug 3429 - Update AM_PATH_SDL2() to also check for SDL2.framework 2016-09-29 16:37:08 -07:00
sdl2.pc.in Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
SDL2.spec.in Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
SDL2Config.cmake Fixed bug 3651 - CMake build does not install CMake package configuration 2017-08-09 19:03:10 -07:00
TODO.txt Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
VisualC.html Fixed two typos in documentation. 2016-01-12 22:23:53 +01:00
WhatsNew.txt Added note for David Carlier's work on OpenBSD 2016-10-12 18:57:12 -07:00

                         Simple DirectMedia Layer

                                  (SDL)

                                Version 2.0

---
https://www.libsdl.org/

Simple DirectMedia Layer is a cross-platform development library designed
to provide low level access to audio, keyboard, mouse, joystick, and graphics
hardware via OpenGL and Direct3D. It is used by video playback software,
emulators, and popular games including Valve's award winning catalog
and many Humble Bundle games.

More extensive documentation is available in the docs directory, starting
with README.md

Enjoy!
	Sam Lantinga				(slouken@libsdl.org)