External gradient time synchronization in wireless sensor networks