<?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>Time required to send a mesh message from client to server</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75901/time-required-to-send-a-mesh-message-from-client-to-server</link><description>Hi, 
 I am using two nrf52840 boards and a Light-Switch example included in the mesh SDK_v5.0. I would like to measure the time required to send a message from client to server. I have enabled logging via RTT for example to see when the message gets sent</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 Jun 2021 13:10:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75901/time-required-to-send-a-mesh-message-from-client-to-server" /><item><title>RE: Time required to send a mesh message from client to server</title><link>https://devzone.nordicsemi.com/thread/313126?ContentTypeID=1</link><pubDate>Wed, 02 Jun 2021 13:10:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e07649a-f4cd-4df7-9625-e3fef69ee38f</guid><dc:creator>Mela</dc:creator><description>&lt;pre class="tw-data-text tw-text-large XcVN5d tw-ta" id="tw-target-text" dir="ltr"&gt;&lt;span class="Y2IQFc" style="font-family:arial, helvetica, sans-serif;font-size:inherit;" lang="en"&gt;Thanks for the quick reply and for your help, much appreciated.&lt;/span&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Time required to send a mesh message from client to server</title><link>https://devzone.nordicsemi.com/thread/313091?ContentTypeID=1</link><pubDate>Wed, 02 Jun 2021 12:20:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f36a1dbc-77a6-4d5a-92cc-f9f3e4ebb7f4</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Mela,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you have a look into the log.h you can find this:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**
 * Prints a log message.
 * @param[in] source Log source
 * @param[in] level  Log level
 * @param[in] ...    Arguments passed on to the callback (similar to @c printf)
 */
#define __LOG(source, level, ...)                                       \
    if ((source &amp;amp; g_log_dbg_msk) &amp;amp;&amp;amp; level &amp;lt;= g_log_dbg_lvl)             \
    {                                                                   \
        log_printf(level, __FILENAME__, __LINE__, log_timestamp_get(), __VA_ARGS__); \
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And this:&amp;nbsp;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;static inline uint32_t log_timestamp_get(void)
{
#if defined(HOST)
    #if defined(__linux__)
        struct timespec now;
        clock_gettime(CLOCK_REALTIME, &amp;amp;now);
        return (now.tv_sec * 1000000UL) + (now.tv_nsec / 1000UL);
    #else
        return 0;
    #endif
#else
    return NRF_RTC1-&amp;gt;COUNTER;
#endif
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So what you see in the log is the RTC&amp;#39;s counter. And RTC1 by default is initialized with prescaler = 0. so the frequency is 32.768kHz.&amp;nbsp;&lt;br /&gt;So each second this counter counts 32768 unit.&amp;nbsp;&lt;br /&gt;Use this you can do calculation and can convert it to second and minute etc. But note that the counter is 24 bits, so it wraps around every 512 seconds. You would need to use some more variable to count if you want to count minutes and hours etc. It&amp;#39;s up to you to modify the log_timestamp_get() function to add more info.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>