Say a piece begins at one tempo, τ1 and then changes to τ2 instantaneously.
We'll model this as two sections, each with it's own equation:
t1i = b1iτ1 + T1
t2j = b2jτ2 + T2
Here t1i means the time-offset of the i-th note in section one. b1i maps notes in section one to beat numbers. T1 tells us the time offset of the start of the first full bar in the first section.
And the same for the second section, replacing 1 with 2. In the above, I've also used j instead of i to make more explicit that it ranges over a different set of numbers (although I will not always do that).
Note that T2 is basically the total length of the first section plus the pause between the sections if any.