<?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>case about rtt log time</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/82476/case-about-rtt-log-time</link><description>Hi, 
 ncs v1.7.1 
 IC:nRF9160 
 How do I set this time to network time?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 08 Dec 2021 03:16:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/82476/case-about-rtt-log-time" /><item><title>RE: case about rtt log time</title><link>https://devzone.nordicsemi.com/thread/342448?ContentTypeID=1</link><pubDate>Wed, 08 Dec 2021 03:16:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8870452a-493f-4669-9859-8b2a84f76510</guid><dc:creator>peter.min</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;H&amp;aring;kon Alseth,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Test ok&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Thank you very much.&lt;br /&gt;Kind regards,&lt;br /&gt;Peter.Min&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: case about rtt log time</title><link>https://devzone.nordicsemi.com/thread/342273?ContentTypeID=1</link><pubDate>Tue, 07 Dec 2021 09:47:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:576fe0ee-0096-4ce3-8100-b20b9638fbdf</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;you can set the log timestamp&amp;nbsp;using this function:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.1/zephyr/reference/logging/index.html?highlight=log_set_timestamp_func#c.log_set_timestamp_func"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.1/zephyr/reference/logging/index.html?highlight=log_set_timestamp_func#c.log_set_timestamp_func&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;Here&amp;#39;s a simple way of adding 1 second offset to the timestamp, just to show how you use the API:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;logging/log_ctrl.h&amp;gt;

#define TS_FREQ 10000

static uint32_t timestamp_func(void)
{
	/* Append one second (define TS_FREQ) offset to the function */
	return (TS_FREQ + (k_cycle_get_32() /
		(sys_clock_hw_cycles_per_sec() / TS_FREQ)));
}

... in main()
    log_set_timestamp_func(timestamp_func, TS_FREQ);
....&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;Kind regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;Håkon&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>