System time api in nRF9160

Hi,

we are using nRF9160, we want to set the UTC time in nRF9160  from my application and want to get the UTC time.

Could please share the API to set and get the time or sample application?

will system time update automatically after Network connection or application has to do that?

Thanks,

Bala

  • Hi Balamurugan

    Is this the RTC API you are looking for: ncs\zephyr\ext\hal\nordic\nrfx\hal\nrf_rtc.h ?

    I have not yet seen an automatic way to update the clock.

    Note: If you want to use GPS, the nrf_gnss_data_frame_t  includes UTC. From "ncs\nrf\samples\nrf9160\gps\src\main.c":

    printk("Time (UTC): %02u:%02u:%02u\n", pvt_data->pvt.datetime.hour,
    					       pvt_data->pvt.datetime.minute,
    					      pvt_data->pvt.datetime.seconds);

Related