timedb: allow bounded usort and fix empty case (return ok instead of [])