# Initial Clock synchronization between multiple smart phones (android OS) connected over Wifi?

I want to synchronize the initial clock of multiple smartphone devices (Android-based) for real-time VoIP communication. Basically, a MANET has been formed and I want to synchronize the clocks up to 5ms difference in MANET.

So far using Ultrasonic chirp, I have been able to synchronize the initial clock with up to 100ms of difference.

What approaches should I follow to get the desired difference?

I have read many research papers I cant use NTP for time-sync and I came to know about PTP about which I am unable to find any algorithm to implement in MANETS.

After researching for many months, I chose Cristian’s Algorithm for the synchronization over the internet up to precision of 10ms. PTP could be used as specific hardware is required for that. So I calculated the nanoTime difference between the clocks of two different Smartphones(Server and client) and by using the algorithm, I computed the OFFSET to be used by the client. Then iteratively I pinged 15 to 20 times to server to send its time again and again and after each try I computed average of the difference between my current nanotime + OFFSET - Received Time from server. This improved by OFFSET with the precision upto 10ms difference.