# What determines the discharge time of Dual slope ADC?

simulate this circuit – Schematic created using CircuitLab

I understand that the charging equation is $$\frac{{V_{in}}\times{t_1}}{{R1}\times{C1}}$$

But bout discharging, the woman puts out something like this:

I do not understand how discharging equation is $$\frac{{V_{ref}}\times{t_2}}{{R1}\times{C1}}$$

The way I see it, at time t1, Vref is positive and Vo1 is positive, and inverting input is GND, so when we switch off S1 and switch ON S2, another current will flow through C1 and charge the capacitor more. I don't see how this will discharge the capacitor.