The dictionary form of a verb, followed by the noun toki ("time"), and, optionally, the particle ni, indicates the time at which an action (expressed by another verb, at the end of the sentence) takes place. Toki in this pattern can mean "when" or "before".
The te iru and ta forms (including te ita) can also be used with toki, but when they are, the meaning of the toki phrase sometimes changes. When the te iru form is used the meaning is closer to "while" and when the ta form is used, the meaning can be "when" or "after".
NOTE: If the verb in the main clause is in the past tense, the verb in the subordinate clause (the toki clause) may be in either the present or past tense.
Neru toki (ni) ha o migakimasu.
Before I go to bed, I brush my teeth.
Shōnen wa kōen o aruite iru toki/ aruite ita toki (ni) saifu o mitsuketa.
The boy found a wallet while walking in the park.
Watashi-tachi wa Hawai e itta toki (ni) fune de ikimashita.
When we went to Hawaii, we went by boat.
Asa okita toki (ni) kao o araimasu.
When/After I get up in the morning, I wash my face.
Hope this helps!
°˖ ✧◝(○ ヮ ○)◜✧˖ °こゆうきあいはら°˖ ✧◝(○ ヮ ○)◜✧˖ °