The past perfect tense indicates that one action in the past was finished before another action in the past. You form the past perfect using
had+past participle.
I had washed my hair before I went to work.
I had finished eating by the time the film started.
"By the time" is a time phrase that is commonly used with the past perfect.
It means-the first action was finished at an unspecified time before the second action was finished.
I hope this helps. :)