{"action":"opened","issue":{"url":"https://api.github.com/repos/espressif/arduino-esp32/issues/1114","repository_url":"https://api.github.com/repos/espressif/arduino-esp32","labels_url":"https://api.github.com/repos/espressif/arduino-esp32/issues/1114/labels{/name}","comments_url":"https://api.github.com/repos/espressif/arduino-esp32/issues/1114/comments","events_url":"https://api.github.com/repos/espressif/arduino-esp32/issues/1114/events","html_url":"https://github.com/espressif/arduino-esp32/issues/1114","id":297199019,"number":1114,"title":"Question about SNTP refresh/updates.","user":{"login":"CelliesProjects","id":24290108,"avatar_url":"https://avatars2.githubusercontent.com/u/24290108?v=4","gravatar_id":"","url":"https://api.github.com/users/CelliesProjects","html_url":"https://github.com/CelliesProjects","followers_url":"https://api.github.com/users/CelliesProjects/followers","following_url":"https://api.github.com/users/CelliesProjects/following{/other_user}","gists_url":"https://api.github.com/users/CelliesProjects/gists{/gist_id}","starred_url":"https://api.github.com/users/CelliesProjects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CelliesProjects/subscriptions","organizations_url":"https://api.github.com/users/CelliesProjects/orgs","repos_url":"https://api.github.com/users/CelliesProjects/repos","events_url":"https://api.github.com/users/CelliesProjects/events{/privacy}","received_events_url":"https://api.github.com/users/CelliesProjects/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-14T18:29:03Z","updated_at":"2018-02-14T18:29:03Z","closed_at":null,"author_association":"NONE","body":"I have 2 ESP32s running as led controllers.\r\nBoth run the same code, and use SNTP to sync the RTC.\r\n\r\nToday after running for 10 days there is a time difference between the 2 devices of about 1 minute.\r\n\r\nI suspect the SNTP code does not update the time after I set it with the following code:\r\n\r\n````cpp\r\nvoid ntpTask( void * pvParameters )\r\n{\r\n  const char * NTPpool         = \"pool.ntp.org\";\r\n  const char * defaultTimezone = \"CET-1CEST,M3.5.0/2,M10.5.0/3\";\r\n  char NTPpoolAdress[20];\r\n\r\n  if ( COUNTRY_CODE_ISO_3166 )\r\n  {\r\n    snprintf( NTPpoolAdress, sizeof( NTPpoolAdress ), \"%s.%s\", COUNTRY_CODE_ISO_3166, NTPpool );\r\n  }\r\n  else\r\n  {\r\n    snprintf( NTPpoolAdress, sizeof( NTPpoolAdress ), \"0.%s\", NTPpool );\r\n  }\r\n\r\n  ESP_LOGI( TAG, \"NTP syncing with %s.\", NTPpoolAdress );\r\n\r\n  configTzTime( preferences.getString( \"timezone\", defaultTimezone ).c_str(), NTPpoolAdress );\r\n\r\n  time_t now;\r\n  struct tm timeinfo;\r\n\r\n  while ( timeinfo.tm_year < ( 2016 - 1900 ) ) {\r\n    vTaskDelay( 50 / portTICK_PERIOD_MS );\r\n    time( &now );\r\n    localtime_r( &now, &timeinfo );\r\n  }\r\n  gettimeofday( &systemStart, NULL );\r\n\r\n  ESP_LOGI( TAG, \"NTP sync @ %s\", asctime( localtime( &systemStart.tv_sec ) ) );\r\n\r\n  /* start time dependent tasks */\r\n\r\n  BaseType_t xReturned;\r\n\r\n  xReturned = xTaskCreatePinnedToCore(\r\n    dimmerTask,                     /* Function to implement the task */\r\n    \"dimmerTask\",                   /* Name of the task */\r\n    2500,                           /* Stack size in words */\r\n    NULL,                           /* Task input parameter */\r\n    dimmerTaskPriority,             /* Priority of the task */\r\n    &xDimmerTaskHandle,             /* Task handle. */\r\n    1);                             /* Core where the task should run */\r\n\r\n  ESP_LOGI( TAG, \"DimmerTask %s.\", ( xReturned == pdPASS ) ? \"started\" : \"failed\" );\r\n\r\n  xReturned = xTaskCreatePinnedToCore(\r\n    loggerTask,                     /* Function to implement the task */\r\n    \"loggerTask\",                   /* Name of the task */\r\n    3000,                           /* Stack size in words */\r\n    NULL,                           /* Task input parameter */\r\n    loggerTaskPriority,             /* Priority of the task */\r\n    &xLoggerTaskHandle,             /* Task handle. */\r\n    1);                             /* Core where the task should run */\r\n\r\n  ESP_LOGI( TAG, \"LoggerTask %s.\", ( xReturned == pdPASS ) ? \"started\" : \"failed\" );\r\n\r\n  vTaskDelete( NULL );\r\n}\r\n````\r\nHow do I check/set the NTP refresh rate?"}}
{"actor":{"display_login":"CelliesProjects"}}