Harry had the best morning he'd had in a long time. (Harry Potter and the Sorcerer's Stone)
The prefect tense above makes a range of which the best is selected out. So, in fact, he’d had in long time means ‘during a long period of time.’ Is this right understanding?