-->
Page 1 of 1

[SOLVED] 'gmtime' was not declared in this scope

PostPosted: Mon Nov 07, 2022 9:55 am
by beic
Hi there,

While I trying to compile the mentioned example code from the link, I'm getting this error message:
'gmtime' was not declared in this scope

https://randomnerdtutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/

I'm using Arduino IDE v1.8.2 with ESP8266 Core v2.3.0

Is there any workaround or maybe a standalone function for gmtime?

Thank you for your time and support,

Kind regards,
Viktor

Re: 'gmtime' was not declared in this scope

PostPosted: Mon Nov 07, 2022 11:23 pm
by rooppoorali
Please check the comment section of your shared tutorial. One person solved this error and explained the method. You can check that. Or have you already tried that options?

Re: 'gmtime' was not declared in this scope

PostPosted: Tue Nov 08, 2022 6:57 am
by beic
rooppoorali wrote:Please check the comment section of your shared tutorial. One person solved this error and explained the method. You can check that. Or have you already tried that options?


Unfortunately, no, if you meant for this line/comment:
#include “time.h” at beginning of the code. Than compilation is OK.

It wont compile, but I used a fork of the NTPClient library and added some additional code to it.
From this page: https://randomnerdtutorials.com/esp32-ntp-client-date-time-arduino-ide/

So, combined two different source and extended the code, and it's solved my issue.

Thanks for the suggestions! ;)