Line synchronization of grid connected power converters is a well recognized problem when the grid is weak, or derives from a remote area power supply with poor frequency regulation. Such systems can suffer significant line voltage distortion due to notches caused by power device switching and/or low frequency harmonic content, which can easily corrupt the output of a conventional zero crossing detector. This paper presents a method of filtering the incoming grid voltage using a recursive discrete Fourier transform (DFT). The filter provides a high degree of noise immunity but does produce a phase shift between the incoming grid voltage and the filtered output voltage when the DFT time window does not match the grid period. Two methods of compensating this phase shift are presented, based on tracking the drift in the phase predicted by the recursive DFT.