Anyone know how to let Arduino count the time when the pin is high and stop when pin is low?
Yes.
There is a pulseIn() function that works well for timing pins that have externally-applied signals, but that does not seem to apply to your case, based on your other post.