Clock synchronization provides fundamental timing reference for various services in the Internet of Things (IoT). Unlike centralized synchronization algorithm, which relies heavily on the synchronization routing and brings about error accumulation consequently, the distributed synchronization algorithm achieves clock synchronization through time message exchange and calculation among adjacent nodes, hence the error accumulation can be greatly eliminated. However, the convergence speed of existing distributed synchronization algorithms is generally slow, and network topology information is seldom utilized to improve the convergence speed, which may cause additional energy consumption especially in resource constrained scenarios. To improve the convergence speed of distributed clock synchronization, a consensus tracking-based clock synchronization (CTCS) algorithm is proposed in this paper. By analyzing the synchronization process in the state space framework, the convergence acceleration term is designed to optimize the eigenvalue distribution of synchronization error matrix, hence the convergence speed can be greatly improved. To be suitable for clock synchronization in the dynamic network, a reference clock input term is designed in the clock update formula, which eliminates the oscillation of synchronized clocks triggered by synchronization of newly joined nodes. To prove the convergence of CTCS, an in-depth analysis of the algorithm is conducted. Both simulation and experimental results validate the effectiveness of CTCS in comparison with other solutions.