SNTP Example

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?


 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

For debugging Iā€™d use wireshork or some other network analysis tool and look for network traffic between your device and an SNTP server.

1 Like


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