Issue with ESP-IDF <time.h>

#include <time.h> results in the IDE not properly seeing setenv() and tzset(), though compile works fine.

Which IDE? VSCode? Eclipse shows it properly in .platformio/packages/framework-espidf/components/newlib/include/stdlib.h (for setenv()) and time.h for tzset after you execute the Build and “Rebuild C/C++ project index” target

Yes VScode. (Looks like I need 20 chars to post eh…)

Then do a rebuild intellisense index (Redirecting...)

I tried that but it did not work. Intelisense is still not seeing it properly.

I still have not figured this out yet, sofar the only solution is to keep that file closed in the IDE unless I need to work on it.

Did you find any resolution for this? I’m seeing the exact same thing…

Version: 1.39.2
Commit: 6ab598523be7a800d7f3eb4d92d7ab9a66069390
Date: 2019-10-15T15:33:00.827Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 18.7.0

The problem with time.h is that it usually exists in several frameworks and libraries and that the wrong one is included.

Can you provide your platformio.ini file, the code of your program that doesn’t compile and the build output?

Same here. Compile is fine, whereas Intellisense complains. Minimal code:

#include <Arduino.h>
#include <time.h>
#include <sys/time.h>

#define NTP_TZ  "CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00"

void setup() {
  // put your setup code here, to run once:
  setenv("TZ", NTP_TZ, 1);
  tzset();
}

void loop() {
  // put your main code here, to run repeatedly:
}

Output in Intellisense (sorry, German… :wink:)

Der Bezeichner ""setenv"" ist nicht definiert.
Der Bezeichner ""tzset"" ist nicht definiert.