SDL_US_TO_NS(3)
β¨ SDL_US_TO_NS(3) β¨
okay so bestie, we're in the SDL3 FUNCTIONS corner of the manual and this one is adorable β it's a macro, it's tiny, and it does exactly one (1) thing. Let's go π
πΈ NAME πΈ
SDL_US_TO_NS β convert microseconds to nanoseconds. that's it. that's the whole job. iconic behavior honestly π
π SYNOPSIS π
#include <SDL3/SDL_timer.h>
#define SDL_US_TO_NS(US) (((Uint64)(US)) * SDL_NS_PER_US)
look at her. one line. no notes. π
π¦ DESCRIPTION π¦
so what this macro does is take your microseconds and hand them back to you as nanoseconds. glow-up, but for units of time β¨
lowkey important: this only converts whole numbers, not fractional microseconds. so if you were hoping to sneak a 0.5 in there, nope, that's not the vibe this macro is on π«
π MACRO PARAMETERS π
USβ the number of microseconds you want converted, bestie.
π RETURN VALUE π
Returns US, expressed in nanoseconds. same number, new unit, main character energy fr fr π«
π₯ THREAD SAFETY π₯
It is safe to call this macro from any thread. no drama, no locks, no anxiety π«Ά
β AVAILABILITY β
This macro is available since SDL 3.2.0. so if you're on something older, it's giving "not yet, bestie" π
and that's the whole page!! tysm for reading, mwah π this was brought to you by the fine folks at Simple Directmedia Layer, running SDL 3.4.18 β stay slay, stay converting, and may all your timers be nanosecond-precise π§β¨π
π¦ 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