Can I shorten the timeout for GetNTPTime() call when NTP server is not functional?

Discussion to talk about software related topics only.
Post Reply
leetehui
Posts: 10
Joined: Thu Aug 27, 2009 2:50 am

Can I shorten the timeout for GetNTPTime() call when NTP server is not functional?

Post 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.
Robert Lee
National Synchrotron Radiation Research Center, Taiwan
User avatar
Jon
Posts: 79
Joined: Mon Feb 05, 2018 10:54 am

Re: Can I shorten the timeout for GetNTPTime() call when NTP server is not functional?

Post 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
leetehui
Posts: 10
Joined: Thu Aug 27, 2009 2:50 am

Re: Can I shorten the timeout for GetNTPTime() call when NTP server is not functional?

Post by leetehui »

Thank you very much for your help. The problem is solved.
Robert Lee
National Synchrotron Radiation Research Center, Taiwan
Post Reply