Past Perfect Continuous
We use the past perfect continuous tense when referring to an action that began in the past and was still happening when a different action started.
It is formed by using the helping verb had together with the linking verb been and the present participle of the verb (base verb + ing).
Example;
We had been driving for 10 minutes when the police stopped us.
Example;
She had been running the company for twenty years by the time she retired.
Or
By the time she retired, she had been running the company for twenty years.