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