Chapter 13. Time

Table of Contents
SDL_GetTicks — Get the number of milliseconds since the SDL library initialization.
SDL_Delay — Wait a specified number of milliseconds before returning.
SDL_AddTimer — Add a timer which will call a callback after the specified number of milliseconds has elapsed.
SDL_RemoveTimer — Remove a timer which was added with SDL_AddTimer.
SDL_SetTimer — Set a callback to run after the specified number of milliseconds has elapsed.

SDL provides several cross-platform functions for dealing with time. It provides a way to get the current time, a way to wait a little while, and a simple timer mechanism. These functions give you two ways of moving an object every x milliseconds: