In kinetic theory of gases, how do we figure out the forces exerted by walls on molecules?

This is a cube with each side having a length of $$l$$ containing a certain amount of molecules in it.

Let's say a molecule of mass m is traveling in the $$y$$-direction with the velocity $$v$$ and hits the wall 1. Obviously, just before the molecule hits the wall 1, its momentum is $$mv$$. After hitting the wall 1, the direction of the molecule will be reversed, and its velocity and momentum will be $$-v$$ and $$-mv$$, respectively. So the change in momentum is $$2mv$$. So far, so good.

Now, let's say the time the molecule is in contact with the wall 1 is $$t$$. In other words, the wall 1 applies a certain force on the molecule for the time $$t$$, so to get the force the wall 1 exerts on the molecule, we simply divide the change in momentum $$2mv$$ by $$t$$.

However, this is not what is done in the proofs I have seen.

As the distance between wall 1 and wall 2 is $$l$$, and the velocity of the molecule is $$v$$, after hitting the wall 1, the time it takes for the molecule to travel back to the wall 2 and come back and hit the wall 1 again is, $$t_1 = \frac{2l}{v}$$.

And they calculate the force the wall 1 exerts on the molecule by dividing the change in momentum $$2mv$$ by $$t_1$$.

It's from the impulse formula $$force \times time = \delta mv$$
Where $$\delta mv$$ stands for change in momentum. They consider it over 1 second, so the time used is 1 second, not the actual time of contact of the molecule with the wall. There are many collisions of the molecule with wall 1 and 2 in one second. The time between collisions is $$\frac{l}v$$, and the number of collisions per second is $$\frac{v}l$$, and the number of collisions with wall 1 per second is $$\frac{v}{2l}$$. So the formula above becomes
$$force \times time = 2mv\times\frac{v}{2l}$$ with $$time =1$$
so the force on wall 1 is $$force = \frac{mv^2}{l}$$