If the student is logged in and attempting the quiz, then it will be submitted at exactly the deadline. There is not way that the student can get extra time to work on the quiz.
It is just that, if they have logged out and gone away, the background house-keeping task that finds overdue quiz attempts and submits them may not run immediately,
And there are other cases, like:
- Student starts quiz attempt
- Student logs out and goes away
- Time limit expires, but quiz housekeeping task has not run yet.
- Student logs in again and goes to the quiz.
Does this let let the students get extra time? No, because actually as soon as the student visits the quiz, we check for the overdue attempt, and the attempt is closed.
We have thought about all the possible combinations of actions, and I am sure there is no way students can get more time than they deserve.
The only problem is that, the Moodle code is too simple-minded about storing the time when the quiz attempt was submitted. It stores the time when whichever bit of code ran to submit the quiz attempt, which is not really very interesting. In the case when the quiz attempt is closed some time later by the house-keepking task, it should set the submit time to the last time at which the student could have done any more work on their attempt.
That would be a more accurate representation of what happened, and avoid the confusion that you have just gone through.
However, this is just about avoiding data that confuses people. There is no way that students can get more than the permitted time to attempt the quiz.