This is new wiki software and old wiki content. It's a work in progress!
Here's the explanation.
Be gentle, report bugs, leave feedback on pages, or just edit them yourself! Thanks!

SDL Wiki

SDL_GetTicks

Get the number of milliseconds since SDL library initialization.

Syntax

Uint32 SDL_GetTicks(void);

Return Value

Returns an unsigned 32-bit value representing the number of milliseconds since the SDL library initialized.

Remarks

This value wraps if the program runs for more than ~49 days.

Code Examples

unsigned int lastTime = 0, currentTime;
while (!quit) {
  // do stuff
  // ...

  // Print a report once per second
  currentTime = SDL_GetTicks();
  if (currentTime > lastTime + 1000) {
    printf("Report: %d\n", variable);
    lastTime = currentTime;
  }
}
SDL_TICKS_PASSED

CategoryAPI, CategoryTimer


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.