ESP 32 problems using internal RTC

ESP32 conflicts with thinger io due to the fact that you cannot use two wifi libraries at the same time with
time.h
and WiFi.h
the problem presents when putting twice SSID and SSIP_PASSWORD,

How can I get the minutes?

Can anyone help?

#include "time.h"
#include <ThingerESP32.h>
#include <ThingerWifi.h>
#include <WiFi.h>

#define SSID "*****"
#define SSID_PASSWORD "********"


ThingerESP32 thing("*****", "***", "**");
const char* ntpServer = "pool.ntp.org"; //servidor ntp Network Time Protocol
const long  gmtOffset_sec =-180000; //GTM -5 time 
const int   daylightOffset_sec =3600;
 
void setup()
{   Serial.begin(9600);
    //Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);
    
    
thing.add_wifi(SSID, SSID_PASSWORD);
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
       
 
  
}

void loop(){
  struct tm timeinfo;
  Serial.println(&timeinfo, "A");
  delay (500);
  int t=timeinfo.tm_hour;   
    
    
    thing.handle(); 
}

```

Hi, at this moment you can inherit the ThingerESP32 class and override the internal listener to know when the wifi is connected, if it is connected to thinger, etc. Something like the following code should work:

#include "time.h"
#include <ThingerESP32.h>
#include <ThingerWifi.h>
#include <WiFi.h>

#define SSID "*****"
#define SSID_PASSWORD "********"

const char* ntpServer = "pool.ntp.org"; //servidor ntp Network Time Protocol
const long  gmtOffset_sec =-180000; //GTM -5 time 
const int   daylightOffset_sec =3600;

class MyESP32 : public ThingerESP32{
  public:
  
  MyESP32(const char* user, const char* device, const char* device_credential) : 
  ThingerESP32(user, device, device_credential)     
  {}
  
   virtual void thinger_state_listener(THINGER_STATE state){
      // call current implementation (debug)
      ThingerESP32::thinger_state_listener(state);
      switch(state){
        case NETWORK_CONNECTED:
          // do here the configuration once WiFi is connected
          configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
          break;
        default:
          break;
      }
   }
};

MyESP32 thing("*****", "***", "**");
 
void setup()
{
  Serial.begin(9600);
  thing.add_wifi(SSID, SSID_PASSWORD);
}

void loop(){
  thing.handle(); 
  struct tm timeinfo;
  Serial.println(&timeinfo, "A");
  delay (500);
  int t=timeinfo.tm_hour;
}

This should work with the master version of the library. In the upcoming library version (3.0), it will be released a new method for listen such events much more easily.

Hope it helps!