Hi all ,
I create a small VoIP application to transmit voice and I want to calculate delay so I need both devices to have the same time if you have an idea to calculate the delay or to synchronize the two devices I will be gretaful for any help
All phones should get their time from the cell tower/service (by default) which is normally syncronized to the global time service (network time protocol). So, normally, you should NOT have to deal with this. If your application needs to, because the devices are in different time zones, then adjust the program's time to GMT on both ends. In any case, they should be within milliseconds of each other when using the same time base. Bear in mind that there will be some lag if one end is in the USA and the other is in Australia or India (etc). Maximum lag? 12000 (1/2 way around earth in miles, approximately) / 186,000 (speed of light in miles/second, approximately) ~= 64.5 milliseconds. IE, a signal at light speed will take about 64 1/2 milliseconds to go 1/2 the way around the earth. Given current communications technology, it will be somewhat longer than that because of switches, repeaters, routing, etc. It could be 100ms or longer.
Note that satellite links will be even longer as geostationary communication satellites are about 25,000 miles from earth, so round trip to another point on earth would be about 50,000 miles, or about 4x the time noted above - or about 250 milliseconds (1/4 second). This will give a noticable lag in speaking, and hearing the reply.