<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>what is the best way to manage time ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15991/what-is-the-best-way-to-manage-time</link><description>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</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 23 Jul 2018 06:36:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15991/what-is-the-best-way-to-manage-time" /><item><title>RE: what is the best way to manage time ?</title><link>https://devzone.nordicsemi.com/thread/140912?ContentTypeID=1</link><pubDate>Mon, 23 Jul 2018 06:36:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe9da2fb-5b31-49c4-a5de-afb110b72af8</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can for example do the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use a repeated &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.0.0/lib_timer.html?cp=4_0_0_3_48"&gt;app timer&lt;/a&gt; instance to wake up at least every time the RTC overflows.&lt;/li&gt;
&lt;li&gt;In the app timer timeout handler, you get the current RTC value using&amp;nbsp;&lt;code&gt;app_timer_cnt_get()&lt;/code&gt; and update a large variable holding elapsed time (ticks).&lt;/li&gt;
&lt;li&gt;Whenever you want to get the time and date, first read the current RTC value using&amp;nbsp;&lt;code&gt;app_timer_cnt_get()&lt;/code&gt; 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.&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: what is the best way to manage time ?</title><link>https://devzone.nordicsemi.com/thread/140376?ContentTypeID=1</link><pubDate>Tue, 17 Jul 2018 11:20:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:923aec4d-feb6-4ae3-ace2-e9948d4de211</guid><dc:creator>vohra alihussain</dc:creator><description>&lt;p&gt;will u explain in detail?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: what is the best way to manage time ?</title><link>https://devzone.nordicsemi.com/thread/60997?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 15:35:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f52de26-52d4-4ba6-b716-1641c959a2c6</guid><dc:creator>cliclem</dc:creator><description>&lt;p&gt;Ok tank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: what is the best way to manage time ?</title><link>https://devzone.nordicsemi.com/thread/60996?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 15:08:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc0099e7-19e5-48ab-8499-9557692b3dc7</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;What I do to keep up time, is wake up at least once per RTC overflow interval, take value from it, calculate seconds passed since previous reading and add them to uint32_t variable used to store passing time. Also, i store exact number of ticks to avoid error accumulation... It is quite accurate that way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>