SDL_NS_TO_SECONDS(3)
π SDL_NS_TO_SECONDS π
okay bestie, welcome to the SDL3 functions manual, page for SDL_NS_TO_SECONDS(3) β yes that's the one, you found it, you're doing amazing π«Ά
β¨ NAME β¨
SDL_NS_TO_SECONDS β convert nanoseconds to seconds. that's it. that's the whole job. she's simple, she's iconic, she's a macro π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_timer.h>
#define SDL_NS_TO_SECONDS(NS) ((NS) / SDL_NS_PER_SECOND)
look at her. one line. no notes. β¨
π¦ DESCRIPTION π¦
so what she does is divide. that's the whole vibe. you hand her some nanoseconds, she hands you back seconds, periodt.
BUT β and this is the part where you gotta pay attention bestie, no cap β because it's literally just a division, the results can be dramatically different depending on whether NS is an integer or a floating point value. like, not a little different. dramatically different. the way that one type versus the other changes everything?? yeah. keep that in mind, iykyk π
π MACRO PARAMETERS π
NSβ the number of nanoseconds you wanna convert, girl. hand it over. π
β RETURN VALUE β
returns NS, but expressed in seconds. glow up complete. π
π THREAD SAFETY π
it is safe to call this macro from any thread. any. thread. she does not care. she is unbothered. she is thriving. π
π AVAILABILITY π
this macro has been available since SDL 3.2.0. so if you're on something older, sorry babe, you're not invited to the function π
ok real talk though β the integer vs floating point thing is the actual plot twist of this page. don't skip it. fr fr.
Simple Directmedia Layer π¦ SDL 3.4.18 β that's the source and the version, mwah, thanks for reading bestie, go convert some nanoseconds, you ate π β¨
π¦ 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