improved time range validation