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

NTP date time nrf9160

Hi,



I am trying to get the current time, using nrf9160 dk with v1.5.1. I  tried using the following functions 

  

date_time_now();
date_time_uptime_to_unix_time_ms();

proj.confg. tried enabling/disabling based on devzone case threads. 

CONFIG_DATE_TIME=y
#CONFIG_LEGACY_TIMEOUT_API=y
CONFIG_DATE_TIME_UPDATE_INTERVAL_SECONDS=10
#CONFIG_LTE_LEGACY_PCO_MODE=y
#CONFIG_DATE_TIME_NTP=y
#CONFIG_SNTP=y
#CONFIG_LTE_PDP_CMD=y
#CONFIG_DATE_TIME_MODEM=n


main 

int64_t date_time_stamp;
     //k_sleep(K_MSEC(25000)); //Wait some time to make sure the Date-Time update has happened
     //date_time_uptime_to_unix_time_ms(&date_time_stamp);
	 date_time_now(&date_time_stamp);
     printf("Date time: %016llX\n", date_time_stamp);


error response


[00:00:06.306,060] [1;33m<wrn> date_time: Valid time not currently available
[0m[00:00:06.313,232] [1;33m<wrn> date_time: date_time_uptime_to_unix_time_ms, error: -61
Date time: 000000000000000lX
[00:00:10.276,641] [1;33m<wrn> date_time: getaddrinfo, error: -11
[00:00:10.283,264] [1;33m<wrn> date_time: getaddrinfo, error: -11
[00:00:10.289,459] [1;33m<wrn> date_time: Not getting time from any NTP server

I already had a look into most if not all the cases on devzone about the subject trying to fix the issue. I tried the sample mqtt_time https://github.com/too1/mqtt_w_date_time/blob/master/src/main.c same issue
Parents Reply Children
No Data
Related