1<HTML 2><HEAD 3><TITLE 4>Time</TITLE 5><META 6NAME="GENERATOR" 7CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ 8"><LINK 9REL="HOME" 10TITLE="SDL Library Documentation" 11HREF="index.html"><LINK 12REL="UP" 13TITLE="SDL Reference" 14HREF="reference.html"><LINK 15REL="PREVIOUS" 16TITLE="SDL_CondWaitTimeout" 17HREF="sdlcondwaittimeout.html"><LINK 18REL="NEXT" 19TITLE="SDL_GetTicks" 20HREF="sdlgetticks.html"><META 21NAME="KEYWORD" 22CONTENT="time"><META 23NAME="KEYWORD" 24CONTENT="function"></HEAD 25><BODY 26CLASS="CHAPTER" 27BGCOLOR="#FFF8DC" 28TEXT="#000000" 29LINK="#0000ee" 30VLINK="#551a8b" 31ALINK="#ff0000" 32><DIV 33CLASS="NAVHEADER" 34><TABLE 35SUMMARY="Header navigation table" 36WIDTH="100%" 37BORDER="0" 38CELLPADDING="0" 39CELLSPACING="0" 40><TR 41><TH 42COLSPAN="3" 43ALIGN="center" 44>SDL Library Documentation</TH 45></TR 46><TR 47><TD 48WIDTH="10%" 49ALIGN="left" 50VALIGN="bottom" 51><A 52HREF="sdlcondwaittimeout.html" 53ACCESSKEY="P" 54>Prev</A 55></TD 56><TD 57WIDTH="80%" 58ALIGN="center" 59VALIGN="bottom" 60></TD 61><TD 62WIDTH="10%" 63ALIGN="right" 64VALIGN="bottom" 65><A 66HREF="sdlgetticks.html" 67ACCESSKEY="N" 68>Next</A 69></TD 70></TR 71></TABLE 72><HR 73ALIGN="LEFT" 74WIDTH="100%"></DIV 75><DIV 76CLASS="CHAPTER" 77><H1 78><A 79NAME="TIME" 80></A 81>Chapter 13. Time</H1 82><DIV 83CLASS="TOC" 84><DL 85><DT 86><B 87>Table of Contents</B 88></DT 89><DT 90><A 91HREF="sdlgetticks.html" 92>SDL_GetTicks</A 93> -- Get the number of milliseconds since the SDL library initialization.</DT 94><DT 95><A 96HREF="sdldelay.html" 97>SDL_Delay</A 98> -- Wait a specified number of milliseconds before returning.</DT 99><DT 100><A 101HREF="sdladdtimer.html" 102>SDL_AddTimer</A 103> -- Add a timer which will call a callback after the specified number of milliseconds has 104elapsed.</DT 105><DT 106><A 107HREF="sdlremovetimer.html" 108>SDL_RemoveTimer</A 109> -- Remove a timer which was added with 110<A 111HREF="sdladdtimer.html" 112>SDL_AddTimer</A 113>.</DT 114><DT 115><A 116HREF="sdlsettimer.html" 117>SDL_SetTimer</A 118> -- Set a callback to run after the specified number of milliseconds has 119elapsed.</DT 120></DL 121></DIV 122><P 123>SDL provides several cross-platform functions for dealing with time. 124It provides a way to get the current time, a way to wait a little while, 125and a simple timer mechanism. These functions give you two ways of moving an 126object every x milliseconds: 127 128<P 129></P 130><UL 131><LI 132><P 133>Use a timer callback function. This may have the bad effect that it runs in a seperate thread or uses alarm signals, but it's easier to implement.</P 134></LI 135><LI 136><P 137>Or you can get the number of milliseconds passed, and move the object if, for example, 30 ms passed.</P 138></LI 139></UL 140> </P 141></DIV 142><DIV 143CLASS="NAVFOOTER" 144><HR 145ALIGN="LEFT" 146WIDTH="100%"><TABLE 147SUMMARY="Footer navigation table" 148WIDTH="100%" 149BORDER="0" 150CELLPADDING="0" 151CELLSPACING="0" 152><TR 153><TD 154WIDTH="33%" 155ALIGN="left" 156VALIGN="top" 157><A 158HREF="sdlcondwaittimeout.html" 159ACCESSKEY="P" 160>Prev</A 161></TD 162><TD 163WIDTH="34%" 164ALIGN="center" 165VALIGN="top" 166><A 167HREF="index.html" 168ACCESSKEY="H" 169>Home</A 170></TD 171><TD 172WIDTH="33%" 173ALIGN="right" 174VALIGN="top" 175><A 176HREF="sdlgetticks.html" 177ACCESSKEY="N" 178>Next</A 179></TD 180></TR 181><TR 182><TD 183WIDTH="33%" 184ALIGN="left" 185VALIGN="top" 186>SDL_CondWaitTimeout</TD 187><TD 188WIDTH="34%" 189ALIGN="center" 190VALIGN="top" 191><A 192HREF="reference.html" 193ACCESSKEY="U" 194>Up</A 195></TD 196><TD 197WIDTH="33%" 198ALIGN="right" 199VALIGN="top" 200>SDL_GetTicks</TD 201></TR 202></TABLE 203></DIV 204></BODY 205></HTML 206>