there is my function to set my timezone for ntp:
Code: Select all
void update_system_timezone(int8_t zone)
{
char timezone[10];
if(zone<0) sprintf(timezone,"UTC%i",zone);
else sprintf(timezone,"UTC+%i",zone);
setenv("TZ", timezone, 1);
tzset();
ESP_LOGI(TAG,"Timezone set to %s",timezone);
}
Code: Select all
void update_system_ntp()
{
if(sntpinit==0)
{
sntp_setoperatingmode(SNTP_OPMODE_POLL);
sntp_setservername(0, "pool.ntp.org");
sntp_init();
sntpinit=1;
}
else
{
//sntp_restart();
}
}
If I set update_system_timezone(1) the ESP give me 17h29, but If I set update_system_timezone(-1), I get the good time.
https://ibb.co/Gpm1JvG
https://ibb.co/fkwJbyN
Thank you.