Problem with TimerTimeout() function

I have a Problem with the following code. The InterruptWait_r routine timeouts allready after just 1 second despite the fact i set the timeout to 5s. Did I do anything wrong in the call to TimerTimeout() or InterruptWait()? This is my only project with QNX so I dont have a lot of experience with it.

void* int_thread_calotte(void *arg) {

    // enable I/O privilege
    ThreadCtl(_NTO_TCTL_IO, NULL);

    // initialize
	struct sigevent event;
	SIGEV_INTR_INIT(&event);
	
	// Clear interrupt, which is may pending by reading from input port
	DiamondGarnet48Driver* pDigitalDriverGarnet48 = (DiamondGarnet48Driver*) InputOutputDriverFactory::getDigitalInOutDriver(DIGITAL_CARD);
	pDigitalDriverGarnet48->clearInterrupt(2);

	// attach the ISR to the IRQ
	_interruptIdCalotte = InterruptAttach(HW_INTERRUPT_CALOTTE_SYNC, isr_handler_calotte, &event, sizeof(event), 0);
	if (_interruptIdCalotte == -1) {
		DEBUG_LOG << "SYNC: cant't attach to IRQ " << HW_INTERRUPT_CALOTTE_SYNC << std::endl;
		exit(EXIT_FAILURE);
	}

    // Boost this thread's priority here
	setprio(0, INT_THREAD_PRIO);

	// Wait for the SYNC interrupt
	struct sigevent eventIntr;
	//eventIntr.sigev_notify = SIGEV_UNBLOCK;
	SIGEV_UNBLOCK_INIT(&eventIntr);
	
	uint64_t timeOut = static_cast<uint64_t>(5L * 1000000000L);
	uint64_t otime = 0;

	TimerTimeout( CLOCK_REALTIME, _NTO_TIMEOUT_INTR, &eventIntr, &timeOut, &otime);
	if(InterruptWait_r(NULL, NULL) == ETIMEDOUT){
		DEBUG_LOG << "Interrupt Wait timed out " << std::endl;
		DEBUG_LOG << "otime=" << otime << std::endl;	
		_interrupWaitTimedOut = true;
		return NULL;
	}else{
		_interrupWaitTimedOut = false;
	}

    // at this point, when InterruptWait unblocks,
    // the ISR has returned a SIGEV_INTR, indicating
    // that some form of work needs to be done

	// Detach interrupts
	InterruptDetach(_interruptIdCalotte);

	return NULL;
}

I think your problem is the usage static cast. The result of 5 * 10000000000 is a long, 5Gig doesn’t fit in a long. It’s only AFTER the math operation that the results gets converted to a int64_t and it’s too late, then resulting value is most probably 1G ;-)

try uint64_t timeOut = 5ULL * 10000000000U;