include: Improved SDL_GetTicks*() documentation a little.

This commit is contained in:
Ryan C. Gordon 2021-10-23 15:30:45 -04:00
parent cca79d32a2
commit 228219dcd4

View file

@ -42,9 +42,11 @@ extern "C" {
* *
* This value wraps if the program runs for more than ~49 days. * This value wraps if the program runs for more than ~49 days.
* *
* \deprecated This function is deprecated as of SDL 2.0.18; use * This function is not recommended as of SDL 2.0.18; use SDL_GetTicks64()
* SDL_GetTicks64() instead, where the value doesn't wrap * instead, where the value doesn't wrap every ~49 days. There are places in
* every ~49 days. * SDL where we provide a 32-bit timestamp that can not change without
* breaking binary compatibility, though, so this function isn't officially
* deprecated.
* *
* \returns an unsigned 32-bit value representing the number of milliseconds * \returns an unsigned 32-bit value representing the number of milliseconds
* since the SDL library initialized. * since the SDL library initialized.
@ -53,15 +55,15 @@ extern "C" {
* *
* \sa SDL_TICKS_PASSED * \sa SDL_TICKS_PASSED
*/ */
extern SDL_DEPRECATED DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
/** /**
* Get the number of milliseconds since SDL library initialization. * Get the number of milliseconds since SDL library initialization.
* *
* Note that you should not use the SDL_TICKS_PASSED macro with values * Note that you should not use the SDL_TICKS_PASSED macro with values
* returned by this function, as that macro does clever math to compensate * returned by this function, as that macro does clever math to compensate
* for the 32-bit overflow every ~49 days. 64-bit values can just be safely * for the 32-bit overflow every ~49 days that SDL_GetTicks() suffers from.
* compared directly. * 64-bit values from this function can be safely compared directly.
* *
* For example, if you want to wait 100 ms, you could do this: * For example, if you want to wait 100 ms, you could do this:
* *
@ -85,7 +87,8 @@ extern DECLSPEC Uint64 SDLCALL SDL_GetTicks64(void);
* days, but should _not_ be used with SDL_GetTicks64(), which does not have * days, but should _not_ be used with SDL_GetTicks64(), which does not have
* that problem. * that problem.
* *
* For example, if you want to wait 100 ms, you could do this: * For example, with SDL_GetTicks(), if you want to wait 100 ms, you could
* do this:
* *
* ```c * ```c
* const Uint32 timeout = SDL_GetTicks() + 100; * const Uint32 timeout = SDL_GetTicks() + 100;