Duration Before Something in the Past
before
Cause of Something in the Past
When
You had not been waiting there for more than two hours when she finally arrived.