title: Measuring time results in return values of 0 or 0.001
body: <p>I am trying to use <code>chrono::steady_clock</code> to measure fractional seconds elapsed between a block of code in my program. I have this block of code working in LiveWorkSpace (<a href="http://liveworkspace.org/code/YT1I%249" rel="nofollow">http://liveworkspace.org/code/YT1I$9</a>):</p>
  
  <pre><code>#include &lt;chrono&gt;
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  int main()
  {
      auto start = std::chrono::steady_clock::now();
      for (unsigned long long int i = 0; i &lt; 10000; ++i) {
         std::vector&lt;int&gt; v(i, 1);
      }
      auto end = std::chrono::steady_clock::now();
  
      auto difference = std::chrono::duration_cast&lt;std::chrono::microseconds&gt;(end - start).count();
  
      std::cout &lt;&lt; "seconds since start: " &lt;&lt; ((double)difference / 1000000);
  }
  </code></pre>
  
  <p>When I implement the same idea into my program like so:</p>
  
  <pre><code>auto start = std::chrono::steady_clock::now();
  // block of code to time
  auto end = std::chrono::stead_clock::now();
  
  auto difference = std::chrono::duration_cast&lt;std::chrono::microseconds&gt;(end - start).count()
  
  std::cout &lt;&lt; "seconds since start: " &lt;&lt; ((double) difference / 1000000);
  </code></pre>
  
  <p>The program will only print out values of <code>0</code> and <code>0.001</code>. I highly doubt that the execution time for my block of code always equals <code>0</code> or <code>1000</code> microseconds, so what is accounting for this rounding and how might I eliminate it so that I can get the proper fractional values?</p>
  
  <p>This is a Windows program.</p>