gmag11/NtpClient

NtpClientLib use question

bill-orange opened this issue · 3 comments

I am calling NTP.getTime() once in setup and now() several times in loop. I am not calling NTP.getTime() in loop. Is this okay?

now() function belongs to Time library. It will return 0 until it get first sync. You do not have to run getTime() normally. You only have to call NTP.begin() inside setup instead in order to start periodic sync. Check examples folder.
I think I will add a bare minimum example for ESP8266.

The simple example would be helpful. I removed all the getTime() calls and added

while (now() == 0) {
    Serial.print("+ ");
    delay (1000);
  }

to loop before now() is used.

Simple example is here finally