  In this paper, we propose a fully distributed algorithm for joint clock skew
and offset estimation in wireless sensor networks based on belief propagation.
In the proposed algorithm, each node can estimate its clock skew and offset in
a completely distributed and asynchronous way: some nodes may update their
estimates more frequently than others using outdated message from neighboring
nodes. In addition, the proposed algorithm is robust to random packet loss.
Such algorithm does not require any centralized information processing or
coordination, and is scalable with network size. The proposed algorithm
represents a unified framework that encompasses both classes of synchronous and
asynchronous algorithms for network-wide clock synchronization. It is shown
analytically that the proposed asynchronous algorithm converges to the optimal
estimates with estimation mean-square-error at each node approaching the
centralized Cram\'er-Rao bound under any network topology. Simulation results
further show that {the convergence speed is faster than that corresponding to a
synchronous algorithm}.
