Change calculation of duration