# SNTP Example

**URL:** <https://forums.digi.com/t/sntp-example/13933>\
**Category:** NET+OS\
**Tags:** sntp, connectcore9p9215, netos\
**Created:** [November 14, 2014, 5:01pm UTC](https://forums.digi.com/t/sntp-example/13933 "2014-11-14T17:01:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hsantana](https://avatars.discourse-cdn.com/v4/letter/h/ed8c4c/32.png) [@hsantana](https://forums.digi.com/u/hsantana)\
**Post date:** [November 14, 2014, 5:01pm UTC](https://forums.digi.com/t/sntp-example/13933/1 "2014-11-14T17:01:11Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![dakotas\_dad](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@dakotas\_dad](https://forums.digi.com/u/dakotas_dad)\
**Post date:** [November 17, 2014, 8:16am UTC](https://forums.digi.com/t/sntp-example/13933/2 "2014-11-17T08:16:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hsantana](https://avatars.discourse-cdn.com/v4/letter/h/ed8c4c/32.png) [@hsantana](https://forums.digi.com/u/hsantana)\
**Post date:** [November 17, 2014, 8:38am UTC](https://forums.digi.com/t/sntp-example/13933/3 "2014-11-17T08:38:12Z")

</div>

Thanks!

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