fix calc_ki to use correct time