Use struct to pass information to event handler

Event handlers takes lot more parameters than just user_data, and it
might be updated later. Pack everything in a struct, so the API doesn't
change later (possibly the ABI though)

Signed-off-by: Max Sikstrom <msikstrom@op5.com>
Renaame time_left to delay in schedule_event

Minor change, but we have decided that delay is a better name than
time_left

Signed-off-by: Max Sikstrom <msikstrom@op5.com>
Rewrite event execution and creation

This guarantees that the event callback is executed once and only once.
If the event is aborted, a abort flag is set, if it is executed
normally, a normal flag is set.

That means, the callback should always clean up its user_data, but only
execute the event if normal is set.

Signed-off-by: Max Sikstrom <msikstrom@op5.com>
Rewrite event queue to use monotonic time

The event queue shouldn't use wall time. It's nasty when administrators
starts updating the system time. To convert to monotonic time, the heap
is also simplified, with the unnessecary pqueue/squeue interface
removed, and packed with the event handling.

the pqueue was an implementation made too generic, and squeue was a
event-specific layer which stored to less information with the event.
This heap is quite small, and embedded with the event queue.

However. It would be nice to get iobroker embedded with the event
module too, so events.c can be replaced with for example libev,
libevent or possibly glib instead.

Signed-off-by: Max Sikstrom <msikstrom@op5.com>