Math behind a PID loop - Specifically managing intagral time?

If I remember correctly

Proportional Gain = Kp

Integral Gain = Ki

Output = (error * Kp) + (error * Ki * Time in error) // I am sure there are variations on this.
Time in error = Time in error + 1 // until error = 0 then reset the Time in error to zero

In software what is the standard method used to cancel out (reduce) the time factor as I get closer to zero error? In my logic my time increases continuously until I hit zero error and then time suddenly equals zero.

Is there an acceptable (standard) way to make time smaller as I approach my error = 0 cross over?

This is about the clearest explanation of a PID you'll ever find:

http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/

There are almost infinite number of variations of PID algorithms, and it sometimes requires tweaking the algorithm to get the best response from a particular system

Regards,
Ray L.

I see what i missed.

double timeChange = (double)(now - lastTime);

errSum += (error * timeChange);

Where I misunderstood the logic. - It is a summation of the errors. I was accumulating the time. Don't accumulate the time!

Dave