title: C++ how to force NTP update every few minutes and check if the update was successful
body: <p>I am writing a piece of code for a small device that has to perform cyclic NTP synchronization with an interval of 1 minute (more or less).
  So this is what I do:</p>
  
  <pre><code>sntp_setoperatingmode(SNTP_OPMODE_POLL);
  if(sntp_getoperatingmode() != SNTP_OPMODE_POLL){
      ESP_LOGE(TAG, "Error setting SNTP operating mode...");
      return false;
  }
  sntp_setservername(0, (char*)NTP_SERVER);
  sntp_init(); 
  time(&amp;now);
  localtime_r(&amp;now, &amp;timeinfo);
  while(timeinfo.tm_year &lt; (2018 - 1900)){
      vTaskDelay(1000 / portTICK_PERIOD_MS); // give some time to NTP...
      time(&amp;now);
      localtime_r(&amp;now, &amp;timeinfo);
  }
  sntp_stop();
  </code></pre>
  
  <p>First NTP synch is easy and goes well, from the second synch the problem will be that the system time will already be more or less equal to what I expect (for sure the tm_year value) so I do not have a way to understand if the new synch with NTP is working or if I am still reading the system time set at the previous iteration (for example 1 minute before).
  Is there any way to tell if NTP is synchronizing correctly?</p>
  
  <p>For sure I could set the system time in the past just before beginning a new synch with NTP so the condition on tm_year would hold but I would like to preserve the integrity of the system time just in case of a failure by NTP.</p>
  
  <p>Any idea?</p>
  
  <p>EDIT: I have many devices that must do the same thing at the same time so I need them to be synchronized as frequently as possible with the same NTP server. Since I can't suppose to have access to a real NTP server (because my devices won't be always connected to the web) I wrote a function that at the beginning tries to synch only on a server from the NTP pool, then I try with a local server (that I know to be always reachable). Obviously the problem is that all devices must synch with the same NTP server and I must be able to check if the synch with the real NTP server was successful or not before going on with the optional query to the local NTP server.</p>