title: How to get time intervals on STM32?
body: <p>I want to measure how long does a single function take on STM32. The only thing I could find is <code>SysTick_Handler</code>. However, that is an periodic interrupt, but what I need is get time interval like:</p>
  
  <pre><code>long t1 = mcu_clock();
  sleep(20);
  long t2 = mcu_clock();
  long diff = (t2 - t1);
  </code></pre>
  
  <p>I've tried C <code>clock()</code>, but it didn't work and always return <code>-1</code>. How can I make it?</p>