SDL_MS_TO_NS(3)

πŸ’– SDL_MS_TO_NS πŸ’–

okay bestie, welcome to the SDL_MS_TO_NS(3) page, part of the SDL3 FUNCTIONS collection ✨ it's short, it's sweet, it's a macro, and honestly? she's iconic for it πŸ’…


✨ NAME ✨

SDL_MS_TO_NS β€” convert milliseconds to nanoseconds, no big deal πŸ¦‹


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_timer.h>

#define SDL_MS_TO_NS(MS)        (((Uint64)(MS)) * SDL_NS_PER_MS)

like. look at her. one line. does exactly what it says πŸŽ€


πŸ’« DESCRIPTION πŸ’«

so here's the vibe check: this macro turns milliseconds into nanoseconds. that's the whole thing. that's the plot.

BUT β€” and this is the part where you gotta pay attention β€” it only converts whole numbers, not fractional milliseconds. so if you roll up with 1.5 ms expecting a cute little answer, that is not the energy here, bestie 😭 whole numbers only, periodt.

🫢 MACRO PARAMETERS 🫢

  • MS β€” the number of milliseconds you wanna convert, babe. hand it over πŸ’œ

⭐ RETURN VALUE ⭐

it hands you back MS, but now expressed in nanoseconds. same number, glow-up edition ✨


🧚 THREAD SAFETY 🧚

you can call this macro from any thread and it's totally safe, no cap 🫢 no locks, no drama, no main character conflict. go off πŸ‘‘


🌈 AVAILABILITY 🌈

this macro has been around since SDL 3.2.0 β€” so if you're on anything older, she's not there yet, sorry babe πŸ™ˆ


lowkey obsessed with how a macro can be this simple and this useful at the same time. it's giving "does one thing and does it perfectly" πŸ’…πŸ”₯

mwah, that's the whole page, hope you understood it fr fr πŸŽ€ this lil' cutie is brought to you by the fine folks at Simple Directmedia Layer, living in SDL 3.4.18, and she's filed under SDL_MS_TO_NS(3) β€” byeeee, go convert some units πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from