By the time she arrived, he had finished his homework, showing the pluperfect tense.
Para cuando ella llegó, él ya había terminado su tarea, mostrando el tiempo pluscuamperfecto.
Para cuando ella llego, el ya habia terminado su tarea, mostrando el tiempo pluscuamperfecto.