SDL_NS_TO_US(3)
π SDL_NS_TO_US π
okay bestie, welcome to SDL3 FUNCTIONS, and today's main character is SDL_NS_TO_US(3) β she converts nanoseconds to microseconds and she does it with zero drama. β¨
πΈ NAME πΈ
SDL_NS_TO_US β convert nanoseconds to microseconds, no cap.
π SYNOPSIS π
#include <SDL3/SDL_timer.h>
#define SDL_NS_TO_US(NS) ((NS) / SDL_NS_PER_US)
π¦ DESCRIPTION π¦
so this one is literally just a division, okay? it takes your nanoseconds and divides them down into microseconds, and that's the whole plot. iconic behavior, honestly.
BUT β and this is the part where you gotta listen to me β because it performs a division, the results can be dramatically different depending on whether NS is an integer or a floating point value. like, dramatically dramatically. π« so know what you're feeding her, bestie.
π MACRO PARAMETERS π
NSβ the number of nanoseconds you wanna convert. that's it, that's the input. π
β RETURN VALUE β
returns NS, but expressed in microseconds. glow up complete. π
π THREAD SAFETY π
it is safe to call this macro from any thread. every thread gets a turn, we don't gatekeep. π«Ά
β¨ AVAILABILITY β¨
this macro is available since SDL 3.2.0. if you're on something older... girl. π
and that's the whole page! go forth and divide responsibly. π
mwah π β brought to you by Simple Directmedia Layer, running SDL 3.4.18. periodt.
π¦ 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