Fix incorrect time calculation.