Distributed synchronization has gradually gained importance over the last two decades. The ad-hoc nature of new applications has increased the need for robust and scalable distributed algorithms that are capable of generating high precision timing information. However, current solutions usually produce phase errors when the frequencies are heterogeneous. This paper proposes a distributed synchronization procedure that can achieve consensus in both frequency and phase. The algorithm uses only local information and is robust to frequency heterogeneity and network topology. A sufficient condition for global convergence is shown by leveraging recent results on coupled oscillators. We further characterize an invariant constant of the algorithm that relates the limiting frequency ω* with the harmonic mean of the clocks' natural frequencies. Simulations are provided to illustrate and verify these properties.