SDL_NS_TO_MS(3)
β¨ SDL_NS_TO_MS β¨
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual π this one's called SDL_NS_TO_MS and she's a tiny little macro with a big job.
πΈ NAME πΈ
SDL_NS_TO_MS β convert nanoseconds to milliseconds. that's it. that's the whole girl. π
π SYNOPSIS π
#include <SDL3/SDL_timer.h>
#define SDL_NS_TO_MS(NS) ((NS) / SDL_NS_PER_MS)
look at her π¦ one #include, one #define, no drama.
π DESCRIPTION π
So basically, this macro does a division. simple right? NOT SO FAST π
The way that it's just (NS) / SDL_NS_PER_MS means the result can be dramatically different depending on whether NS is an integer or a floating point value. like, actually dramatically. not a little bit. dramatically. π
Integer division and floating point division are not the same vibe, and this macro does not care. it just divides. iykyk. π
π§ MACRO PARAMETERS π§
NSβ the number of nanoseconds you wanna convert, bb. that's the input. that's the whole input. πΈ
β RETURN VALUE β
Returns NS, expressed in milliseconds. π
she gives back what you gave her, just in a different unit. glow up. β¨
π THREAD SAFETY π
It is safe to call this macro from any thread. π«Ά
no locks, no worries, no main character fights over shared state. every thread can have her. π
π AVAILABILITY π
This macro is available since SDL 3.2.0. so if you're on something older... bestie. upgrade. π
and that's the tea π go forth and convert your nanoseconds, you absolute icon. β
mwah π this page came to you from the Simple Directmedia Layer, running SDL 3.4.18, and yeah it's SDL_NS_TO_MS(3) β 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