SDL_GetCurrentTime(3)
π SDL_GetCurrentTime(3) β SDL3 FUNCTIONS π
okay bestie so real quick: the manual name is SDL_GetCurrentTime, it lives in the SDL3 functions crew, and it's genuinely one of the most low-key useful little guys in the whole time header. let's get into it π«Ά
β¨ NAME β¨
SDL_GetCurrentTime β gets the current value of the system realtime clock in nanoseconds since Jan 1, 1970 in Universal Coordinated Time (UTC).
like. it's a clock. it tells you now. but in a very specific unit and a very specific epoch and a very specific timezone vibe. iykyk β°β¨
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_time.h>
bool SDL_GetCurrentTime(SDL_Time *ticks);
not me pulling out the SDL_Time type like it's nothing. she's the main character of this whole function tbh π
π FUNCTION PARAMETERS π
ticksβ theSDL_Timeto hold the returned tick count. that's it. that's the whole parameter list. she doesn't need more, she's efficient, she's iconic π
π¦ RETURN VALUE π¦
Returns true on success or false on failure β and if it's a false situation, bestie you call SDL_GetError() for more information. do NOT just sit there wondering what happened. the info is right there π
π THREAD SAFETY π
It is safe to call this function from any thread. π§
literally any thread. main thread, worker thread, the thread you made at 3am and forgot about β she does not care, she's chill like that. no cap π«Ά
β AVAILABILITY β
This function is available since SDL 3.2.0.
so if you're on anything older than that, ma'am... it's giving "please upgrade" π
heads up: the realtime clock here is realtime β nanoseconds since Jan 1, 1970, UTC. if you wanted something else, this is not that thing. the manpage says exactly this and nothing more, and we respect the manpage π
and that's the whole page, babe π this little legend came to us via Simple Directmedia Layer, rocking version SDL 3.4.18, dated SDL_GetCurrentTime(3) β obsessed with her, go forth and timestamp things responsibly πΈπ β¨
π¦ 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