Home/Support/Support Forum/SNTP Example
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

SNTP Example

0 votes
I am trying to run the SNTP Example project to set the time.

I followed the instructions on the readme file.(Activating SNTP on BSP Services, defining the variable on appconf)

I also set an ip for the sntp server from a popular STNP Server (appconf.h)

I have internet connection on my device.

I am getting this result:
----> mktime Sat Jan 17 07:32:44 1970

----> ctime Sat Jan 17 07:32:44 1970

----> Saturday January 17 @ 07:32:44 AM

----> mktime Sat Apr 3 07:32:44 2004

----> ctime Sat Apr 3 07:32:44 2004

----> Saturday April 03 @ 07:32:44 AM

----> mktime Sun Apr 4 08:32:44 2004

----> ctime Sun Apr 4 08:32:44 2004

----> Sunday April 04 @ 08:32:44 AM

----> mktime Sat Oct 30 08:32:44 2004

----> ctime Sat Oct 30 08:32:44 2004

----> Saturday October 30 @ 08:32:44 AM

So the time is not updated.

What could be causing the sample project to not work?
asked Nov 14, 2014 in NET+OS by hsantana New to the Community (22 points)

Please log in or register to answer this question.

1 Answer

+1 vote
 
Best answer
Hello

I know I have used this feature many times successfully. You may have done these steps but they bear repeating:

In bsp_sys.h BSP_INCLUDE_SNTP must be set to TRUE.
In appconf.h define APP_SNTP_PRIMARY and APP_SNTP_SECONDARY to working SNTP servers (make sure you"ping" them to ensure they are up.

In appconf.h ensure that APP_USE_NETWORK_TIME_PROTOCOL is defined
(#define APP_USE_NETWORK_TIME_PROTOCOL)

For debugging I'd use wireshork or some other network analysis tool and look for network traffic between your device and an SNTP server.
answered Nov 17, 2014 by dakotas_dad Veteran of the Digi Community (694 points)
selected Nov 17, 2014 by hsantana
Thanks!

I got the problem, I was only using one SNTP server and probably it was down.
...