title: get boost::posix_time::time_duration in seconds
body: <p>I am using <code>boost::posix_time::ptime</code> to measure my simulation run-time and for something else.</p>
  
  <p>assuimg</p>
  
  <pre><code>boost::posix_time::ptime start, stop;
  boost::posix_time::time_duration diff;
  start = boost::posix_time::microsec_clock::local_time();
  sleep(5);
  stop = boost::posix_time::microsec_clock::local_time();
  diff = stop - stop;
  </code></pre>
  
  <p>now</p>
  
  <pre><code>std::cout &lt;&lt; to_simple_string( diff ) &lt;&lt; std::endl;
  </code></pre>
  
  <p>return the time in <code>hh:mm:ss.ssssss</code> format and i would like to have the time as well in <code>ss.sssssss</code>.</p>
  
  <p>for doing this, i tried</p>
  
  <pre><code>boost::posix_time::time_duration::sec_type x = diff.total_seconds();
  </code></pre>
  
  <p>but that gave me the answer in format of ss and <code>seconds()</code> returns Returns normalized number of seconds (0..60).</p>
  
  <p>My question how could i get my simulation time in seconds of the format ss.ssssss?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>i was able to do:</p>
  
  <pre><code> std::cout &lt;&lt; diff.total_seconds() &lt;&lt; "." &lt;&lt;  diff.fractional_seconds() &lt;&lt; std::endl;
  </code></pre>
  
  <p>is there something elegant that could plot ss.sssssss? </p>