Why timezone is inverted ?
Posted: Sat Jan 30, 2021 6:35 pm
Hello,
there is my function to set my timezone for ntp:
and init:
I'm in UTC+1 timezone, windows give me the for exemple: 19h29.
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.
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.