Something I've recently worked with using an integrator. Perhaps might be of help.
The goal is to measure phase between two square waves. If you feed the two signals into a XOR gate, then one can show that the output will have different width or delta t which is directly proportional to a phase between the square waves.
The output looks something like this:
[PLAIN]http://www.pcsilencioso.com/cpemma/graphics/swave.gif
The wider the signal, the more phase difference there is. Now, what you want to do is to get DC voltage output that is proportional to the phase difference, and all you have is this rectangular pulse wave. How would you recover the width?
The answer is with an integrator. We known that the amplitude is constant. If you integrate this rectangular pulse wave, then you get the area under the rectangle which is (Amplitude * Delta t) and the delta t is the width you are after which is proportional to phase difference.