add time logic