Page 1 of 1
Can I shorten the timeout for GetNTPTime() call when NTP server is not functional?
Posted: Sun Mar 01, 2020 7:40 pm
by leetehui
Can I shorten the timeout for GetNTPTime call when NTP server is not functional?
The timeout for GetNTPTime function is so long that device will reset when watchdog function is enabled.
Re: Can I shorten the timeout for GetNTPTime() call when NTP server is not functional?
Posted: Fri Mar 06, 2020 10:40 am
by Jon
Hi Robert,
There isn't a parameter that you can pass in to change the timeout value, but if you go to the GetNTPTime() function definition in ntpclient.cpp, you can manually edit the timeout value that the function spends waiting on an NTP response. This is found on the line:
UDPPacket urpkt(&fifo, 10 * TICKS_PER_SECOND);
You can adjust this number to meet your needs. TICKS_PER_SECOND by default is set to 20. Please note that after this change, you will need to rebuild the system libraries.
Kind Regards,
Jon
Re: Can I shorten the timeout for GetNTPTime() call when NTP server is not functional?
Posted: Mon Mar 09, 2020 6:42 pm
by leetehui
Thank you very much for your help. The problem is solved.