SDL Wiki
(This is the documentation for SDL3, which is under heavy development and the API is changing! SDL2 is the current stable version!)


Get the number of milliseconds since SDL library initialization.


Uint64 SDL_GetTicks64(void);

Return Value

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


Note that you should not use the SDL_TICKS_PASSED macro with values returned by this function, as that macro does clever math to compensate for the 32-bit overflow every ~49 days that SDL_GetTicks() suffers from. 64-bit values from this function can be safely compared directly.

For example, if you want to wait 100 ms, you could do this:

const Uint64 timeout = SDL_GetTicks64() + 100;
while (SDL_GetTicks64() < timeout) {
    // ... do work until timeout has elapsed


This function is available since SDL 3.0.0.

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.