sdlTimeToDateTime function

bool sdlTimeToDateTime(
  1. int ticks,
  2. Pointer<SdlDateTime> dt,
  3. bool localTime
)

Converts an SDL_Time in nanoseconds since the epoch to a calendar time in the SDL_DateTime format.

\param ticks the SDL_Time to be converted. \param dt the resulting SDL_DateTime. \param localTime the resulting SDL_DateTime will be expressed in local time if true, otherwise it will be in Universal Coordinated Time (UTC). \returns true on success or false on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC bool SDLCALL SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime)

Implementation

bool sdlTimeToDateTime(int ticks, Pointer<SdlDateTime> dt, bool localTime) {
  final sdlTimeToDateTimeLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Int64 ticks, Pointer<SdlDateTime> dt, Uint8 localTime),
      int Function(int ticks, Pointer<SdlDateTime> dt,
          int localTime)>('SDL_TimeToDateTime');
  return sdlTimeToDateTimeLookupFunction(ticks, dt, localTime ? 1 : 0) == 1;
}