<?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>System specific function to retrieve a timestamp (in microseconds)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73404/system-specific-function-to-retrieve-a-timestamp-in-microseconds</link><description>Hi Team, 
 Is this system specific function to retrieve a timestamp (in microseconds) function directly available or we need to develop?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 31 Mar 2021 14:47:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73404/system-specific-function-to-retrieve-a-timestamp-in-microseconds" /><item><title>RE: System specific function to retrieve a timestamp (in microseconds)</title><link>https://devzone.nordicsemi.com/thread/302779?ContentTypeID=1</link><pubDate>Wed, 31 Mar 2021 14:47:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:007df2b0-bc27-4367-b49d-d3d5fd0f1265</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="Karl Ylvisaker"]Are you looking to create a timer or use the RTC to keep track of how long time in microseconds that has passed since a certain event, for example? If so, that is possible with the app_timer library or the RTC/TIMER peripheral directly, for example.[/quote]
&lt;p&gt;You can either use the app_timer library for this, or the TIMER peripheral directly. The TIMER peripheral approach is demonstrated in &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/nrf_dev_timer_example.html"&gt;the Timer peripheral example in the SDK&lt;/a&gt;. You can read more about the app_timer in &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_timer.html"&gt;the app_timer library documentation&lt;/a&gt;. The app_timer is also used in most of the BLE examples peripheral examples, so you could take a look there to see how it can be used.&lt;br /&gt;Since you only specify that you need microsecond accuracy, you might be able to use &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Frtc.html"&gt;the Real Time Counter&lt;/a&gt;&amp;nbsp;to reduce power consumption, but since I dont know your exact application requirements its hard to say if this is applicable.&lt;br /&gt;Depending on how long your device will be running each time it is booted and what solution you choose to proceed with, you might have to implement logic to catch any buffer overflows, so that you dont loose track of how much time has passed.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: System specific function to retrieve a timestamp (in microseconds)</title><link>https://devzone.nordicsemi.com/thread/302762?ContentTypeID=1</link><pubDate>Wed, 31 Mar 2021 13:28:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cdfd49bc-52f8-4196-9dec-4fc478547ff8</guid><dc:creator>Sridhar Jonnavittula</dc:creator><description>&lt;p&gt;I need&amp;nbsp;k_uptime_get() , similar to this API in ncs/applications/nrf/asset_tracker.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: System specific function to retrieve a timestamp (in microseconds)</title><link>https://devzone.nordicsemi.com/thread/302678?ContentTypeID=1</link><pubDate>Wed, 31 Mar 2021 08:34:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8d79d2f-9813-4074-905a-60415a682a2a</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;I must say as @awneil that I am not exactly sure what you are asking for here. Are you looking to create a timer or use the RTC to keep track of how long time in microseconds that has passed since a certain event, for example? If so, that is possible with the app_timer library or the RTC/TIMER peripheral directly, for example.&lt;br /&gt;If you are looking to have the peripheral device sync to the time of a central, you may for example use the&amp;nbsp;&lt;em&gt;Current Time Service&amp;nbsp;&lt;/em&gt;to pass a timestamp from the central to the peripheral device - please see &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/ble_sdk_app_cts_c.html"&gt;the CTS Example from the SDK&lt;/a&gt;.&lt;br /&gt;If this was not what you were asking about, please elaborate.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: System specific function to retrieve a timestamp (in microseconds)</title><link>https://devzone.nordicsemi.com/thread/302596?ContentTypeID=1</link><pubDate>Tue, 30 Mar 2021 13:11:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a56ee92b-b70e-4de2-a0c4-ec1b5b84e189</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Sorry - I don&amp;#39;t get what you&amp;#39;re asking?&lt;/p&gt;
&lt;p&gt;what &amp;quot;timestamp&amp;quot; are you looking for?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>