FreeRTOS-Kernel/FreeRTOS-Plus/Demo/coreSNTP_Windows_Simulator
Archit Aggarwal a44df5c1b9
Fix clock drift issue in SNTP demo (#655)
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.
2021-07-19 16:05:35 -07:00
..
DemoTasks Fix clock drift issue in SNTP demo (#655) 2021-07-19 16:05:35 -07:00
common_demo_include.h Add unauthenticated mode demo for coreSNTP library for time synchronization (#621) 2021-06-10 13:42:42 -07:00
core_pkcs11_config.h Add authentication support to coreSNTP demo (#625) 2021-06-16 10:22:06 -07:00
core_sntp_config.h Add unauthenticated mode demo for coreSNTP library for time synchronization (#621) 2021-06-10 13:42:42 -07:00
core_sntp_demo.sln Add unauthenticated mode demo for coreSNTP library for time synchronization (#621) 2021-06-10 13:42:42 -07:00
demo_config.h Fix clock drift issue in SNTP demo (#655) 2021-07-19 16:05:35 -07:00
FreeRTOSConfig.h Add unauthenticated mode demo for coreSNTP library for time synchronization (#621) 2021-06-10 13:42:42 -07:00
FreeRTOSIPConfig.h Add unauthenticated mode demo for coreSNTP library for time synchronization (#621) 2021-06-10 13:42:42 -07:00
main.c Add authentication support to coreSNTP demo (#625) 2021-06-16 10:22:06 -07:00
mbedtls_config.h Add authentication support to coreSNTP demo (#625) 2021-06-16 10:22:06 -07:00
readme.url Add unauthenticated mode demo for coreSNTP library for time synchronization (#621) 2021-06-10 13:42:42 -07:00
WIN32.vcxproj Fix clock drift issue in SNTP demo (#655) 2021-07-19 16:05:35 -07:00
WIN32.vcxproj.filters Add authentication support to coreSNTP demo (#625) 2021-06-16 10:22:06 -07:00

[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://www.freertos.org/sntp/sntp-demo.html