  In this paper a new distributed asynchronous algorithm is proposed for time
synchronization in networks with random communication delays, measurement noise
and communication dropouts. Three different types of the drift correction
algorithm are introduced, based on different kinds of local time increments.
Under nonrestrictive conditions concerning network properties, it is proved
that all the algorithm types provide convergence in the mean square sense and
with probability one (w.p.1) of the corrected drifts of all the nodes to the
same value (consensus). An estimate of the convergence rate of these algorithms
is derived. For offset correction, a new algorithm is proposed containing a
compensation parameter coping with the influence of random delays and special
terms taking care of the influence of both linearly increasing time and drift
correction. It is proved that the corrected offsets of all the nodes converge
in the mean square sense and w.p.1. An efficient offset correction algorithm
based on consensus on local compensation parameters is also proposed. It is
shown that the overall time synchronization algorithm can also be implemented
as a flooding algorithm with one reference node. It is proved that it is
possible to achieve bounded error between local corrected clocks in the mean
square sense and w.p.1. Simulation results provide an additional practical
insight into the algorithm properties and show its advantage over the existing
methods.
