sdlxTimeToDateTime function time

bool sdlxTimeToDateTime(
  1. int ticks,
  2. SdlxDateTime dateTime, {
  3. bool localTime = false,
})

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.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.2.0.

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

Implementation

bool sdlxTimeToDateTime(
  int ticks,
  SdlxDateTime dateTime, {
  bool localTime = false,
}) {
  final dateTimePointer = dateTime.calloc();
  final result = sdlTimeToDateTime(ticks, dateTimePointer, localTime);
  if (result) {
    dateTime.loadFromPointer(dateTimePointer);
  }
  dateTimePointer.callocFree();
  return result;
}