(Not a Teacher)
When you're directly quoting someone, you will, of course, use the same tenses they used in their statement. However, if you're paraphrasing someone, you will match the tenses of the indirect quote to that of the sentence, be it past, present, or future.
Imperatives are always present tense, to my knowledge.
The part starting with 'when' is a subordinate clause, I believe. Their verb tense may be different from the main clause. I'm not an expert, however, so I will defer to the professional educators on this site.
- For Teachers