SDL_DateTimeToTime(3)

πŸ’– SDL_DateTimeToTime(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're talking about SDL_DateTimeToTime β€” the lil glow-up potion that takes a calendar time and turns it into an SDL_Time, measured in nanoseconds since the epoch. yes, nanoseconds. she's precise like that. ✨


✨ NAME ✨

SDL_DateTimeToTime β€” converts a calendar time to an SDL_Time in nanoseconds since the epoch. πŸ•°οΈπŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_time.h>

bool SDL_DateTimeToTime(const SDL_DateTime *dt, SDL_Time *ticks);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, here's the tea: this function takes your cute lil SDL_DateTime and hands you back an SDL_Time. that's it. that's the whole job. no cap.

but wait β€” important detail alert 🚨 β€” it completely ignores the day_of_week member of the SDL_DateTime struct. like, doesn't even look at it. so if you never set it, that's totally fine, it can stay unset, she does not care. live your truth, leave day_of_week blank. πŸ™ˆ


🌸 FUNCTION PARAMETERS 🌸

  • dt β€” the source SDL_DateTime. your input, your calendar moment, the origin story. πŸ’–
  • ticks β€” the resulting SDL_Time. this is where the converted value lands. the glow-up destination. ✨

πŸ”₯ RETURN VALUE πŸ”₯

returns true on success, or false on failure. and if it's a fail? call SDL_GetError() for more info, because she will absolutely tell you what went wrong. no guessing games. πŸ’€


🧚 THREAD SAFETY 🧚

it is safe to call this function from any thread. every thread. all the threads. go wild, bestie, no locks needed, she's built different. πŸ‘‘


⭐ AVAILABILITY ⭐

this function has been available since SDL 3.2.0. iconic behavior, honestly. 🫢


ngl, if you're out here doing time math in nanoseconds, you're giving main character energy. go off. 🌈

Simple Directmedia Layer 🌸 SDL 3.4.18 🌸 SDL_DateTimeToTime(3)

and that's the whole page, bestie β€” mwah, slay, periodt, catch you in the next manpage πŸ’œπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from