SDL_SECONDS_TO_NS(3)

πŸ’– SDL_SECONDS_TO_NS πŸ’–

okay bestie so you're in the SDL3 FUNCTIONS part of the manual and this is literally the page for SDL_SECONDS_TO_NS β€” the little macro that takes your seconds and hands them back to you as nanoseconds. no cap, that's the whole vibe. πŸ•βž‘οΈβœ¨


πŸŽ€ NAME πŸŽ€

SDL_SECONDS_TO_NS β€” convert seconds to nanoseconds. that's it, that's the job. πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_timer.h>

#define SDL_SECONDS_TO_NS(S)    (((Uint64)(S)) * SDL_NS_PER_SECOND)

one include, one macro, zero drama. πŸ¦‹


🌸 DESCRIPTION 🌸

okay so here's the tea: this macro converts seconds into nanoseconds, and that's giving very straightforward.

but bestie, listen β€” it only converts whole numbers, not fractional seconds. so if you were hoping to sneak a 0.5 in there and have it do something cute, nope. whole numbers only. periodt. 🫢


🧚 MACRO PARAMETERS 🧚

  • S β€” the number of seconds to convert. hand it over, it'll do the math. πŸ”₯

πŸ‘‘ RETURN VALUE πŸ‘‘

Returns S, expressed in nanoseconds. so like, same number, different unit, main character energy. ✨


πŸ’œ THREAD SAFETY πŸ’œ

It is safe to call this macro from any thread. yes fr fr β€” any thread, any time, no anxiety, no vibe check required. πŸ’€πŸ«Ά


🌈 AVAILABILITY 🌈

This macro is available since SDL 3.2.0. so if you're on something older... bestie. upgrade. 😭


lowkey iconic that a single multiply is carrying this whole page. Uint64 cast, times SDL_NS_PER_SECOND, done. no notes. πŸ’…βœ¨

mwah πŸ’– this has been the SDL_SECONDS_TO_NS page, brought to you by Simple Directmedia Layer β€” SDL 3.4.18, dated right there in the SDL_SECONDS_TO_NS(3) footer. go forth and multiply (by SDL_NS_PER_SECOND). πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from