This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

9160 ntp data_time

hi support team.

i want to use time from ntp server, and we have example in nrf/lib/data_time;

after devzone searching, i added below setting to prj.config

CONFIG_DATE_TIME=y
CONFIG_DATE_TIME_MODEM=n
CONFIG_DATE_TIME_NTP=y

CONFIG_BSD_LIBRARY=y
CONFIG_DATE_TIME_UPDATE_INTERVAL_SECONDS=20

and added code after k_sem_take(&lte_connected, K_FOREVER); in NCS1.5.0 udp example. i was using cat-NB

int64_t unix_time_ms;

err = date_time_now(&unix_time_ms);

/*Print the current time */
printk("Date_time: %d %d\n", (int32_t)(unix_time_ms/1000000), (int32_t)(unix_time_ms%1000000));

compile is ok, flash is ok, but there is one problem that can't get ntp server addr as below:

00> *** Booting Zephyr OS build v2.4.99-ncs1 ***
00> UDP sample has started
00> W: getaddrinfo, error: -11
00> W: getaddrinfo, error: -11
00> W: getaddrinfo, error: -11
00> W: getaddrinfo, error: -11
00> W: getaddrinfo, error: -11
00> W: Not getting time from any NTP server

however in windows, i can see the the server is ok, as below, for now i don't know how to fix this. could you please help to confirm where is the problem

Regards,

William.

Parents Reply Children
No Data
Related