How to extract the current time from the calendar_example, i am not clear with the procedure
How to extract the current time from the calendar_example, i am not clear with the procedure
Hi
You would use the nrf_cal_get_time(void) function for this.
It returns a pointer to a tm struct which contains the current time in seconds, minutes, hours and so on.
You can also use the nrf_cal_get_time_string(bool calibrated) function if you just want a string representation of the current time.
Best regards
Torbjørn
Hi,
nrf_log module doesnt work now.. I am working on it, mean while can you please check this out..
this was the output when i used int datatype
EDIT : I am getting the same result using the character array pointer as well
below is the code i used for character array
char k[16]; for(int i = 0; i < sizeof(nrf_cal_get_time_string(true)); i++) { k[i] = nrf_cal_get_time_string(true)[i]; } err_code = ble_nus_data_send(&m_nus, k, &lendt, m_conn_handle);
Hi
How do you reset the time to start with?
I will try to merge the calendar example with the ble_app_uart example to see if I can reproduce your issue. You should hear from me soon ;)
Best regards
Torbjørn
Hi,
I don't know how to reset the time, But i did try the following function from the same library :
uint32_t year = 2020; uint32_t month = 8; uint32_t day = 14; uint32_t hour = 20; uint32_t minute = 5; uint32_t second = 55; nrf_cal_set_time(year, month, day, hour, minute, second);
But this gave me an error.
Thank you , I am awaiting for your reply
Hi,
I don't know how to reset the time, But i did try the following function from the same library :
uint32_t year = 2020; uint32_t month = 8; uint32_t day = 14; uint32_t hour = 20; uint32_t minute = 5; uint32_t second = 55; nrf_cal_set_time(year, month, day, hour, minute, second);
But this gave me an error.
Thank you , I am awaiting for your reply