Go Down

Topic: WiFi.getTime() doesn't work (Read 432 times) previous topic - next topic


Hello everybody.

I'm trying to initialize the rtc of MKR1000 as described in the WifiRTC sample code, but it seems that the WiFi.getTime() function doesn't workproperly.
The following fragment of code gives always the "NTP ureachable"  message.

int InitRtcWithNTP(void)
  unsigned long ulEpoch;
  int iNumberOfTries = 0, iMaxTries = 6;
    ulEpoch = WiFi.getTime();
  while ((ulEpoch == 0) && (iNumberOfTries < iMaxTries));

  if (iNumberOfTries >= iMaxTries)
    PRINTLN("NTP unreachable!!");
    return 1;
  PRINT("Epoch received: ");
  return 0;

I've checked that arduino can reach internet, resolve addresses and successfully ping an host on internet both using the name and the address.
I've checked also that from inside my home network the ntpservers are reachable (I've tried with a NTP query tool to query a server at us.pool.ntp.org).

Is there a problem in my code, in the library or where else?

I'm using IDE 1.8.8 with WiFi101ver. 0.15.3.

Did anyone had the same problem?
I'm looking forward to receive suggestions.



I have the same issue with MKR1000 WiFi.getTime() . Couldn't solve it yet.
Did you find a solution in the meantime?



I'm still awaiting for a solution...


Hy, currently I'm using the workaround suggested on the github wifi libray page, i. e. use a dhcp server with address reservation to get a static ip address.

Go Up