SDL_GetTicks(3)
π SDL_GetTicks π
okay bestie, so this is a page from the SDL3 FUNCTIONS manual β yes, that SDL, the Simple Directmedia Layer one, the icon of cross-platform multimedia π . And this particular little diva is all about counting milliseconds. Let's get into it.
β¨ NAME β¨
SDL_GetTicks β get the number of milliseconds that have elapsed since the SDL library initialization. that's it. that's the whole job. she's a stopwatch and she's booked and busy π°οΈ
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_timer.h>
Uint64 SDL_GetTicks(void);
no arguments, no drama, no parameters. she takes nothing and gives you a whole Uint64. main character energy fr fr π
π RETURN VALUE π
she hands back an unsigned 64-bit integer β that's Uint64, keep up π β and that number represents the count of milliseconds that have elapsed since the SDL library got initialized. and like, initialized how? typically via a call to SDL_Init, iykyk.
so: milliseconds since SDL woke up and chose violence. periodt.
π§ THREAD SAFETY π§
good news bestie: it is safe to call this function from any thread. any. thread. she does not care. she is unbothered, moisturized, in her lane πβ¨
β AVAILABILITY β
this one has been available since SDL 3.2.0. so if you're on anything older, sorry babe, she's not there yet π
π¦ SEE ALSO π¦
SDL_GetTicksNS(3)β the nanosecond girlie, if milliseconds aren't precise enough for your little heart π«Ά
π quick reminder: every single fact above came straight from the official page β I just gave it a makeover. don't come for me, come for the source.
and that's the whole thing, no cap π this cutie lives in the Simple Directmedia Layer docs, version SDL 3.4.18 β and yeah, the footer situation has no date on it, so we're just repping the source and the version and calling it iconic ππ bye bestie, go measure some ticks!
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms