compareDateTime method

int compareDateTime(
  1. DateTime other
)

Implementation

int compareDateTime(DateTime other) {
  final retValuePtr = calloc<Int32>();
  final otherDateTime =
      other.difference(DateTime.utc(1601, 01, 01)).inMicroseconds * 10;

  try {
    final hr = ptr.ref.vtable
            .elementAt(94)
            .cast<
                Pointer<
                    NativeFunction<
                        HRESULT Function(
                            Pointer, Uint64 other, Pointer<Int32>)>>>()
            .value
            .asFunction<int Function(Pointer, int other, Pointer<Int32>)>()(
        ptr.ref.lpVtbl, otherDateTime, retValuePtr);

    if (FAILED(hr)) throw WindowsException(hr);

    final retValue = retValuePtr.value;
    return retValue;
  } finally {
    free(retValuePtr);
  }
}