Modify sum_time to add more checks on time validation.