After this message exchange, the slave has four timestamps from which both
the slave offset (time offset by which the slave clock leads or lags the master)
and the network delay (the time taken for packets to traverse the network link
between the two nodes) can be determined.
The link delay can be calculated as follows:
MasterSlave
delay
=
t
ms
=
t
2
–
t
1
SlaveMaster
delay
=
t
sm
=
t
4
–
t
3
In each case, the time differences refer to times taken from different clocks
which may be offset from each other. However, if the assumption is made that
the delay in one direction is the same as the delay in the opposite direction,
then the two equations can be combined as follows:
Delay =
(t
2
–
t
1
) + (t
4
–
t
3
)
2
From Figure 14.3, it can be seen that the slave clock offset (the time interval by
which the slave leads the master) is given by:
Offset =
t
2
–
(t
1
+ Delay)
Substituting from Figure 14.3 above:
rearranging results in:
Offset =
t
2
–
t
1
–
½
t
2
+
½
t
1
–
½
t
4
+
½
t
3
= ½(2
t
2
– 2
t
1
–
t
2
+
t
1
–
t
4
+
t
3
)
2
GEN3t
366
I3995-3.1 en HBM: public