<?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>&amp;lt;time.h&amp;gt; clock() HARD FAULT</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7759/time-h-clock-hard-fault</link><description>Trying to see how much time my code consumes, I tried the naive approach, calling clock() in the beginning and at the end and comparing the values. 
 But when I include clock() on my code, it just breaks. The function wasn&amp;#39;t even called. Why is that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 21 Jul 2015 12:22:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7759/time-h-clock-hard-fault" /><item><title>RE: &lt;time.h&gt; clock() HARD FAULT</title><link>https://devzone.nordicsemi.com/thread/27629?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 12:22:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d02c8df-88b8-4bba-bf3a-b708209a71e1</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;thanks for updating :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: &lt;time.h&gt; clock() HARD FAULT</title><link>https://devzone.nordicsemi.com/thread/27628?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 12:19:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64e446be-3be3-4e3d-bcef-b0edd1693778</guid><dc:creator>Victor Nascimento</dc:creator><description>&lt;p&gt;Turned out that my &lt;code&gt;time_consuming_task()&lt;/code&gt; function was giving a Stack Overflow, thus hard-faulting the processor. I presume it has nothing to do with &lt;code&gt;clock()&lt;/code&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: &lt;time.h&gt; clock() HARD FAULT</title><link>https://devzone.nordicsemi.com/thread/27626?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 11:59:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58abdf14-94b8-4bb1-8aea-85660d66e4b2</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Victor, could you please update this thread with latest info, I want to avoid closing threads with goodinfo as unresolved&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: &lt;time.h&gt; clock() HARD FAULT</title><link>https://devzone.nordicsemi.com/thread/27625?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2015 13:59:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d3d89e4-33b0-4dd7-9f7c-403ac3fbef06</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;@RK, i think the clock() just return the current tick which is updated in systems with operating systems. Here as there is no OS, it will never get updated and hence will return the same value always. It would compile as the variable do exist in the library, just that the mechanism to update it does not.
Using clock() is of no use here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: &lt;time.h&gt; clock() HARD FAULT</title><link>https://devzone.nordicsemi.com/thread/27624?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2015 13:27:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c4f9af9-57b0-4cc6-8a18-96397702f20a</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;where&amp;#39;s the implementation of clock()? Sure it&amp;#39;s in the standard c library but I can&amp;#39;t see how it could possibly be implemented on something with no operating system, no real time clock, no gettimeofday(), no nothing. I&amp;#39;m fairly surprised it links, I&amp;#39;m not at all surprised it fails.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: &lt;time.h&gt; clock() HARD FAULT</title><link>https://devzone.nordicsemi.com/thread/27623?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2015 12:58:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d572131f-c54c-447b-b88e-fdaed52e7214</guid><dc:creator>Victor Nascimento</dc:creator><description>&lt;p&gt;I comment the line, code works fine. I don&amp;#39;t know what happened.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: &lt;time.h&gt; clock() HARD FAULT</title><link>https://devzone.nordicsemi.com/thread/27622?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2015 12:47:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0b92f61-ff16-4e2f-9114-061c05fa81f9</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;It should not have hardfaulted. Are you sure that clock() function is causing it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: &lt;time.h&gt; clock() HARD FAULT</title><link>https://devzone.nordicsemi.com/thread/27627?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2015 11:59:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98138885-ce2a-4cda-bba1-ee9a24641053</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;If You are using RTC in Your project, You can just check it&amp;#39;s registers value to see time passing. Check app_timer.h library.
Or You can set/clear GPIO and measure time on oscilloscope...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>