Timerset: Improve programmability.
Add a test that would've caught the timer bug.
Improve handling of timers whose events trigger before they fire.

Let's say that every time a timer fires, you set 3 others, far in
the future; and then trigger 2 of the resulting events. For instance,
maybe the timers correspond to timeouts for messages that arrive,
making the timeouts irrelevant.

Previously, we used some random heuristics to try to find and remove
these timers from the heap. But the heuristics didn't work well
(and the optimizations were broken).

So instead, every time we add a timer to a relatively large timer
set, we check a random timer in the set to see if it's triggered
(the event is empty). If it has triggered, we remove it from the
set and look for another random element. This seems to work well.