Why is 'which' the correct relative pronoun in this sentence, and not 'when'..?

The relativized element is not at ten to nine, but ten to nine. This makes it a noun phrase and not a prepositional phrase, which explains why we use relative word which.

Main clause counterpart:

Ten to nine is just before the exam begins.

If we were to use when as the realtive word, we'd rephrase:

At ten to nine, when the exam is about to begin, please make sure you assemble...