gmag11 / ESPNtpClient

High accuracy NTP library for ESP32 and ESP8266
MIT License
119 stars 26 forks source link

basicExample doesn't work: #20

Closed schroepfer closed 3 years ago

schroepfer commented 3 years ago

please see here:

Arduino: 1.8.15 (Mac OS X), Board: "LOLIN(WEMOS) D1 mini Pro, 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 16MB (FS:14MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 921600"

In file included from /Users/Juergen-S/Documents/Arduino/libraries/ESPNtpClient-main/examples/basicExample/basicExample.ino:5: /Users/Juergen-S/Documents/Arduino/libraries/ESPNtpClient-main/src/ESPNtpClient.h: In member function 'char NTPClient::getTimeStr(timeval)': /Users/Juergen-S/Documents/Arduino/libraries/ESPNtpClient-main/src/ESPNtpClient.h:557:35: error: cannot convert 'suseconds_t' {aka 'long int'} to 'const time_t' {aka 'const long long int*'} 557 tm* local_tm = localtime (&moment.tv_usec); ^~~~~~~
suseconds_t {aka long int}

In file included from /Users/Juergen-S/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.0/cores/esp8266/HardwareSerial.h:31, from /Users/Juergen-S/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.0/cores/esp8266/Arduino.h:288, from /Users/Juergen-S/Documents/Arduino/libraries/ESPNtpClient-main/examples/basicExample/basicExample.ino:1: /Users/Juergen-S/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.0-newlib4.0.0-gnu23-48f7b08/xtensa-lx106-elf/include/time.h:64:37: note: initializing argument 1 of 'tm localtime(const time_t)' 64 | struct tm localtime (const time_t _timer); | ~~~~^~~~ exit status 1 Fehler beim Kompilieren für das Board LOLIN(WEMOS) D1 mini Pro.

PedroMasunaga commented 3 years ago

I get the same error when using version 3.0.0 of the ESP core. After downgrading to 2.7.4 it works fine. ezTime too.

gmag11 commented 3 years ago

Hi, there is a fix just released to solve compilation errors in newer SDK. Please give a try. I've just tested it both for ESP32 and ESP8266