mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-15 01:07:47 -04:00
Issue The existing clock discipline algorithm in the coreSNTP demo yields an inaccurate wall-clock time (in UTC) that is always behind the astronomical UTC time by the chosen polling interval period of the demo. The issue with the clock discipline algorithm was that it was calculating the slew rate to make the system clock be gradually compensated for the previous time synchronization clock drift over the period of the subsequent polling time interval. Thereby, the clock slew rate correction calculated is always lower than it should be (because it does not incorporate possible clock drift that would occur over another period of time polling interval till the next time synchronization attempt). Fix This PR fixes the clock discipline algorithm to make the demo calculate its system time that matches the astronomical UTC time. The fix involves simplifying the clock discipline algorithm to use a combination of step and slew correction approaches where: 1. Step correction is applied on EVERY time successful synchronization with a time server. This immediately corrects the system time to match server time. 2. Slew rate is calculated ONCE (on the second successful time synchronization with server) and applied henceforth, on every time polling interval period to compensate gradually for the system clock drift during the period. |
||
---|---|---|
.. | ||
DemoTasks | ||
common_demo_include.h | ||
core_pkcs11_config.h | ||
core_sntp_config.h | ||
core_sntp_demo.sln | ||
demo_config.h | ||
FreeRTOSConfig.h | ||
FreeRTOSIPConfig.h | ||
main.c | ||
mbedtls_config.h | ||
readme.url | ||
WIN32.vcxproj | ||
WIN32.vcxproj.filters |
[{000214A0-0000-0000-C000-000000000046}] Prop3=19,11 [InternetShortcut] IDList= URL=https://www.freertos.org/sntp/sntp-demo.html