How to Have Patience During Calamity?

There is a famous story of Ibn Abbas when he was on a journey with some of his companions, a messenger comes and whispered something into his ear. Ibn Abbas listens to what he has to say, then he immediately faced the Qiblah and prayed two units of prayer.