The simplest way to maintain an RTC counter

Right now I use the app_timer_cnt_get() method to get a current tick count. It appears to return a counter that increases with 32768 counts per second. However, it overflows after 512 seconds. I need this counter to monotonically increase as long as there is power supplied to the platform to do this for time stamping purposes.

To do that I need to keep track of a rollover and update a another unsigned long long counter that takes significantly longer to overflow. I have to use a timer function to be sure I call the app_timer_cnt_get() method more frequently than once every 512 seconds to assure my counter gets updated in case there is no need to create a time stamp for a period longer than 512 seconds. For example, when my device is not connected to a peer.

What I have done appears to work. However, I was wondering if such a functionality is already available in one of the many libraries; in other words is there some method that is already running somewhere down there that does this for me?

Parents Reply Children
No Data
Related