Does using time_t still result in time rollover when using configTime?
Posted: Tue Jun 04, 2019 1:09 am
I am using my esp32 to connect to Google Cloud IoT Core and I am trying to track down very sporadic connectivity issues and it either has to be my connection to IoT Core or just the network connection
When the sketch starts I set the time on the board with
then to create the Json Web Token I check the time against the current expire time to see if it needs refreshing and I wonder if I am unable to connect sometimes because the time rolled back to zero?
here is my JWT refresh method
Do I need to handle things differently somehow?
When the sketch starts I set the time on the board with
Code: Select all
configTime(0, 0, "pool.ntp.org", "time.nist.gov");
here is my JWT refresh method
Code: Select all
String getJwt() {
if (iss == 0 || time(nullptr) - iss > 82800) {
iss = time(nullptr);
Serial.print("Time");
Serial.println(iss);
Serial.println("Refreshing JWT");
jwt = device->createJWT(iss);
Serial.println(jwt);
} else {
Serial.println("Reusing still-valid JWT");
}
return jwt;
}