Wireless sensor and actuator networks (WSANs) consists of a large number of sensors and a relatively small number of actuators connected through wireless links. In the WSANs applications, sensors detect the events in their environment and inform actuators. The actuators cooperate together and respond quickly to events. To coordinate their operations, a common time reference to all nodes in the network is a critical need. In this paper, we propose an accurate time synchronization protocol for WSANs, namely Sensor and Actuator Networks Synchronization Protocol (SANSync), which allows the clocks of all sensors and actuators in the network to be synchronized with a reference clock. SANSync is based on clustering; it takes advantage of the large transmission capacity of actuators to increase the accuracy of time synchronization. The simulation results show that the proposed protocol increases significantly the accuracy of time synchronization compared to FTSP and FCSA protocols.