Distributed synchronization algorithms for wireless sensor networks