# time synchronization

Is there any way how to precisely synchronize time in two connected devices? For instance, to measure ping/latency.

edit retag close merge delete

Is it possible to be more specific as to what you mean by two connected devices? Do the devices have an AllJoyn session established between them? If yes, over which transport? Also, what level of precision (millisecond / microsecond) are you aiming for?

( 2015-05-17 02:36:03 -0800 )edit

Yes, they have an AllJoyn session established, The communicate using BusObject.Signal. Microseconds are fine.

( 2015-05-22 08:34:03 -0800 )edit

Sort by » oldest newest most voted

IMHO, time synchronization between two nodes of a network (distributed system) is best achieved via NTP.

To measure latency between two nodes, you can try using ajn::BusAttachment::Ping.

A crude form of time synchronization using AllJoyn is possible by doing the following:

• Set up an AllJoyn session between the two nodes
• Send multiple ajn::BusAttachment::Ping messages between the two nodes to get an average round-trip-time.
• Send AllJoyn messages containing the time-stamp at one end to the other node (after defining necessary objects, interfaces and members)
• Based on this, one should be able to calculate the time difference between the clocks of two nodes

As I mentioned already, the above is quite crude. NTP is far more sophisticated to synchronize times between two nodes.

more