sdlxDateTimeToTime function time

int? sdlxDateTimeToTime(
  1. SdlxDateTime dateTime
)

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

This function ignores the day_of_week member of the SDL_DateTime struct, so it may remain unset.

\param dt the source SDL_DateTime. \param ticks the resulting SDL_Time. \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_DateTimeToTime(const SDL_DateTime *dt, SDL_Time *ticks)

Implementation

int? sdlxDateTimeToTime(SdlxDateTime dateTime) {
  int? result;
  final dateTimePointer = dateTime.calloc();
  final ticksPointer = ffi.calloc<Int64>();
  final bl = sdlDateTimeToTime(dateTimePointer, ticksPointer);
  if (bl) {
    result = ticksPointer.value;
  }
  dateTimePointer.callocFree();
  ticksPointer.callocFree();
  return result;
}