TIME_TO_SYNC = 100 sync_timer = 0 timesync_state = 0 # Function to sync. algo function check_time_sync(){ sync_timer = sync_timer + 1 if(sync_timer < TIME_TO_SYNC){ log(" Synchronizing Clock : ",sync_timer,"/",TIME_TO_SYNC) timesync_state = 1 } else timesync_state = 0 } # Function to set sync timer to zero and reinitiate sync. algo function reinit_time_sync(){ sync_timer = 0 }