refactor time_mode select logic to a separate file