title: What's the Difference Between floor and duration_cast?
body: <p>So in <a href="/questions/tagged/c%2b%2b11" class="post-tag" title="show questions tagged &#39;c++11&#39;" rel="tag">c++11</a> the Chrono Library provides, <a href="http://en.cppreference.com/w/cpp/chrono/duration/duration_cast" rel="noreferrer"><code>duration_cast</code></a>:</p>
  
  <blockquote>
    <p>Computations are done in the widest type available and converted, as if by static_cast, to the result type only when finished</p>
  </blockquote>
  
  <p>And <a href="/questions/tagged/c%2b%2b17" class="post-tag" title="show questions tagged &#39;c++17&#39;" rel="tag">c++17</a>'s <a href="http://en.cppreference.com/w/cpp/chrono/duration/floor" rel="noreferrer"><code>floor</code></a>:</p>
  
  <blockquote>
    <p>Returns the greatest duration t representable in ToDuration that is less or equal to d</p>
  </blockquote>
  
  <p>So for all <code>x</code> will the result of these 2 calls be equal:</p>
  
  <ol>
  <li><code>chrono::duration_cast&lt;chrono::seconds&gt;(x)</code></li>
  <li><code>chrono::floor&lt;chrono::seconds&gt;(x)</code></li>
  </ol>