SDL_DelayPrecise(3)

✨ SDL_DelayPrecise ✨

okay bestie, welcome to the SDL_DelayPrecise(3) page, it's a lil function from the SDL3 FUNCTIONS lineup and honestly? it's giving ✨patience✨ πŸ’…

It waits a specified number of nanoseconds before returning. That's it. That's the whole vibe. πŸ¦‹


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_timer.h>

void SDL_DelayPrecise(Uint64 ns);

no cap, that's the whole signature. one param, no return value, she's simple and she knows it πŸ’–


πŸ’« DESCRIPTION πŸ’«

so here's the tea πŸ“ β€” this function waits a specified number of nanoseconds before returning. It will attempt to wait as close to the requested time as possible, busy waiting if necessary, but could return later due to OS scheduling.

the way I need you to understand this: she is trying her best to be precise (it's literally in the name, main character energy πŸ‘‘), and she'll spin around doing nothing (that's the busy waiting, iykyk, it's the "not me refreshing the page 400 times" of programming πŸ”₯) just to land on your number. But if the OS decides to schedule something else first? yeah. you might get your callback late. not her fault. she's not the scheduler. 😭


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • ns β€” the number of nanoseconds to delay. literally just "how long do you want to wait, in ns" 🫢

🧚 THREAD SAFETY 🧚

It is safe to call this function from any thread. so go off, call her from wherever, every thread gets a turn, we love an inclusive queen πŸ’œβœ¨


🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0. if you're on something older... girl. upgrade. πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘


ok so real talk β€” she's precise, not psychic. "as close as possible" β‰  "exactly on time, every time". OS scheduling said what it said and we respect her boundaries πŸ’…

and that's the page!! mwah πŸ’– this came to you from Simple Directmedia Layer, SDL version 3.4.18, dated SDL_DelayPrecise(3) β€” slay, bye bestie!! πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from