Since Core of ESP8266 upgraded to v.3.0 (now it is 3.0.2), I encounter errors using this library.

First, the deprecation of byte to uint8 (hoped that an upgrade of NTP lib to 3.0.2 beta will solve it ), but now even using library's built in example file fails, show the same message regarding byte error.

Is there a workaround ?

In file included from /home/guy/Documents/git/Arduino/libraries/NtpClientLib/examples/NTPClientESP8266/NTPClientESP8266.ino:38:
/home/guy/Documents/git/Arduino/libraries/NtpClientLib/src/NtpClientLib.h:501:32: error: reference to 'byte' is ambiguous
  501 |     bool summertime (int year, byte month, byte day, byte hour, byte weekday, byte tzHours);
      |                                ^~~~
In file included from /home/guy/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/xtensa-lx106-elf/include/c++/10.3.0/cmath:42,
                 from /home/guy/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/xtensa-lx106-elf/include/c++/10.3.0/math.h:36,
                 from /home/guy/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/Arduino.h:34,
                 from sketch/NTPClientESP8266.ino.cpp:1:


pic1 pic2 IDE+Sketch file

  • I just compiled that example fine no problem with 3.0.2. Maybe there's something broken about your Arduino / ESP8266 installation.
    – Majenko
    Jul 30, 2021 at 18:17
  • Or maybe your libraries are out of date...?
    – Majenko
    Jul 30, 2021 at 18:30
  • @Majenko - see installed version, IDE, and Example sktech fails
    – guyd
    Jul 30, 2021 at 18:40
  • 1
    Don't use the library manager to install libraries. Download it direct from Github. You can pretty much guarantee that whatever is in the library manager will be out of date.
    – Majenko
    Jul 30, 2021 at 18:50
  • @Majenko - Amazing!! You were right. I delted all NTPClient libraries, and reinstalled only from github... and its OK now. Thnk you
    – guyd
    Jul 30, 2021 at 19:19

1 Answer 1


The esp8266 Arduino 3 has breaking changes so library authors need to adjust their libraries to this changes. Check the repository of the library for the fixes.

The NtpClient library was marked as deprecated by the author. The reason was that there is a better way to work with NTP on ESP. Now the library was 'restarted' as an alternative to SDK functions because the author solved microseconds accuracy.

If you don't need microseconds accuracy, you don't need to use Arduino NtpClient library on esp8266 or esp32. The Espressif SDK have support to get the NTP time to internal RTC.

Both ESP Arduino cores have examples for NTP. For esp8266 it is the esp8266/NTP-TZ-DST example.

The NTP part should be in setup()

configTime(TIME_ZONE, "pool.ntp.org");

TIME_ZONE should be value from TZ_ constants from TZ.h, for example I have

#include <TZ.h>
#define TIME_ZONE TZ_Europe_Bratislava

The SDK will keep the time with the internal RTC of the ESP and adjust it periodically from NTP server.

You can get the esp8266 RTC time time with

time_t t = time(nullptr); // epoch
struct tm *tm = localtime(&t);
uint8_t minute = tm->tm_min;
uint8_t hour = tm->tm_hour;

if you want to wait in setup() until the time is retrieved you can use

  time_t now = time(nullptr);
  while (now < SECS_YR_2000) {
    now = time(nullptr);
  • Firstly, thank you very much. Second, is there a way to update daylight saving automatically ?
    – guyd
    Jul 30, 2021 at 20:20
  • 1
    @Guy.D, it adjusts for day light saving time automatically. I built an alarm clock with esp8266 and these functions. github.com/jandrassy/SunriseClock
    – Juraj
    Jul 31, 2021 at 5:19
  • Tough your answer avoids the use of the library asked, but to mark it as an Answer, I need you to reff to Majenko's answer, that actually solved it.
    – guyd
    Jul 31, 2021 at 7:39
  • @Guy.D, I updated the answer
    – Juraj
    Jul 31, 2021 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.