timer: add API to query ticks until the next timer