tm_timer: Fix early timeouts.

Maintain the invariant that last_time + timers_head->time is the time
of the next item in the queue throughout tm_timer_callback for when
JS callbacks call setTimeout.
Merge remote-tracking branch 'origin/tcr-487' into km-try