Support clock events with expiry longer than clock period
DeanoBurrito opened this issue · comments
Currently the system clock allows adding events with an expiry time longer than the period of the backing clock.
This could lead to undefined results (depending on how the underlying hardware handles the write - like its just an overflow).
One possible solution is allow the sys timer to report its maximum period, and this is compared against the next value to be used for a timer interrupt. It it's too long we inject a fake event at the head of list, as many as necessary until the target time is reached.
This might also be a good time to look at adding new events to the front of the queue, which would require cancelling and then resetting the sys timer. This should be doable in most cases.