title: Convert system clock (microsecond) stored in int64_t to float(s)?
body: <p>Currently I have a function, f(), which returns the current system clock in microseconds. I need to convert it to seconds, preserving several digits after the decimal point. I want to store the result in a float(is it long enough?).</p>
  
  <p>But what f() returns is a int64_t variable; I tried many methods, like:</p>
  
  <pre><code>(double)(f() / 1000000) + (double)((f() % 1000000) / (double)1000000);
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>f() / 100000.f
  </code></pre>
  
  <p>But what I got in fact looks like "1318395904.000000".</p>
  
  <p>UPDATE:</p>
  
  <p>What I want to do is to calculate FPS of my program. It seems converting it into second first is a bad idea. I rewrote my program like this, and both method work well:</p>
  
  <p>(PS, av_gettime() is the function f() I mentioned.)</p>
  
  <pre><code>std::cout &lt;&lt; "Yoooooo FPS: " &lt;&lt; (float)5000000 / (float)(av_gettime() - prevFrameShowTime)
            &lt;&lt; std::endl;
  std::cout &lt;&lt; "Current FPS: " &lt;&lt; (double)5000000 / (double)(av_gettime() - prevFrameShowTime)
            &lt;&lt; std::endl;
  </code></pre>
  
  <p>And here is the output:</p>
  
  <pre><code>Yoooooo FPS: 60.623
  Current FPS: 60.6097
  </code></pre>