Hi all,
In my project i want to get the timestamp with help of RTC. but when i am printing timestamp it is giving timestamp after power on of the device but i want epoch time for current date and time. how i can get that?
Thanks,
Revati
Hi all,
In my project i want to get the timestamp with help of RTC. but when i am printing timestamp it is giving timestamp after power on of the device but i want epoch time for current date and time. how i can get that?
Thanks,
Revati
Hi,
The RTC peripheral in the nRF52840 is a real time counter only, and the counter is reset on every reset. If you need to keep the current date and time after powering the device off and on again you need something else, like a dedicated calendar RTC IC. Alternatively, if you don't always need a date and time after reset, you could for instance connect to a phone with the current time service (CTS), to get the time and keep the current time in firwmare. But it will be loest upon the next reset.
what i want is whenever any api init is fail for dump log it should print time and date how i can do that?
Hi,
You can enable time stamps in the logger module if you like (see log Logging). This will just refer to time since boot/reset though. As mentioned the nRF has no way of maintaining the clock when it is powered off or reset, so if you need that, you need something external to tell it the time.
Hi,
What are different external ways to tell the time can you tell ?
One is using an external Real Time Clock IC. The other I can think of is if your application connects regularly to a phone via Bluetooth, it can get the time from there using the current time service as demonstrated in the Bluetooth: Peripheral CTS client sample.