correct time calculation