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
- 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