SDL_DelayNS(3)
π SDL_DelayNS(3) π
okay so bestie, welcome to the SDL3 FUNCTIONS corner of the manual, and today's main character is SDL_DelayNS β she naps, but like, in nanoseconds. iconic behavior honestly π«Ά
β¨ NAME β¨
SDL_DelayNS β wait a specified number of nanoseconds before returning. yes, nanoseconds. she's precise like that π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_timer.h>
void SDL_DelayNS(Uint64 ns);
π¦ DESCRIPTION π¦
so like. this function waits a specified number of nanoseconds before it returns. that's it, that's the whole vibe. β¨
but here's the tea, and it's important: she waits at least the specified time, but possibly longer due to OS scheduling. so if you're out here expecting exactly that many nanoseconds, no cap, that's not what's happening β the OS is doing its own thing and your little nap might run long. not her fault, it's giving "scheduling," iykyk π
π FUNCTION PARAMETERS π
nsβ the number of nanoseconds to delay. that's your sleepytime number, bestie. π
π THREAD SAFETY π
It is safe to call this function from any thread. fr fr. every thread gets to nap, no gatekeeping π
π AVAILABILITY π
This function is available since SDL 3.2.0. so if you're on something older... girl. upgrade. π
β SEE ALSO β
lowkey reminder: "at least" is the whole point. don't come for her when the timing drifts. π
and that's the page!! brought to you by the lovely humans at Simple Directmedia Layer, running SDL 3.4.18, and this little love letter to nanoseconds is dated SDL_DelayNS(3). slay, go take a nap, you deserve it π§π
π¦ 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