An Adaptive-Rate Time Synchronization Protocol for Wireless Sensor Networks