So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By drifterz28
#77771 I am working with an esp8266 NodeMcu 1.0 building a 2 zone sprinkler system, I had everything working and wanted to make some code changes to it but one day I started getting this error
Code: Select all'localtime' was not declared in this scope


for time I am using these 3 libraries in my sketch
Code: Select all#include <NTPClient.h>
#include <Time.h>
#include <TimeLib.h>


I have am unsure about what has changed in any of those includes and wanted to know if anyone else is having this issue or has come across something like it.

full code can be found at https://github.com/drifterz28/sprinkler ... -sprinkler
User avatar
By btidey
#77790 Note that time.h is not the same as Time.h

time.h has the definition of localtime. Time.h just loads TimeLib.h which does not include localtime.

It is possible that something else in your code was loading time.h before.

You could try adding the include for time.h as well as the others.