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 β€” the SDL_Time to 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