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

what is the best way to manage time ?

Hello,

I would like to manage time (hours, minutes, seconds) on NRF52 chip: what is the best way to do it ? How to use as less energy as possible ?

At the first connection with a smartphone I can send for example the number of seconds since the beginning of the day to setup current time ...

Thank you

Parents Reply Children
  • Hi,

    You can for example do the following:

    • Use a repeated app timer instance to wake up at least every time the RTC overflows.
    • In the app timer timeout handler, you get the current RTC value using app_timer_cnt_get() and update a large variable holding elapsed time (ticks).
    • Whenever you want to get the time and date, first read the current RTC value using app_timer_cnt_get() to get it up to date, and then calculate the actual time and date in SW. For this to work, you must have set the time at some point, so that you know the time and date that correspond to the timer ticks you have stored. The SW also need to implement a calendar so that it handles leap years and leap seconds etc.
Related