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)

See also:

Implementation

int? sdlxDateTimeToTime(SdlxDateTime dateTime) => ffi.using((arena) {
  final dateTimePointer = dateTime.toNative(arena);
  final ticksPointer = arena<Int64>();

  if (sdlDateTimeToTime(dateTimePointer, ticksPointer)) {
    return ticksPointer.value;
  }
  return null;
});