Student or Learner
"I’m sorry. I didn’t do the homework,” Peter said to the teacher."
1) Peter apologized to the teacher for not doing the homework.
2) Peter apologized to the teacher for not having done the homework.
In my opinion, the first sentence would give the impression that Peter won't do the homework at the time meanwhile the second one gives the impression that Peter didn't do the homework which was assigned to him from the previous class.
Which one is correct in this situation? I wonder if we can use two of these sentences as alternative or not. Please explain. Thank in advance.
They are both correct and mean the same.