title: What is the best way to form custom std::chrono::durations and std::ratios?
body: <p>I was reading <a href="https://stackoverflow.com/a/27859915/576911">this excellent answer</a> which used the comical time duration unit <code>microfortnights</code> to illustrate a good point in a memorable way.</p>
  
  <pre><code>typedef std::ratio&lt;756, 625&gt; microfortnights;
  std::chrono::duration&lt;int, microfortnights&gt; two_weeks(1000000);
  </code></pre>
  
  <p>And the question occurred to me:</p>
  
  <blockquote>
    <p>If I really wanted to do this (more likely some other non-trivial
    duration such as the time available during a frame, or during N cycles
    of a processor), what is the best way to do this?</p>
  </blockquote>
  
  <p>I know <code>ratio&lt;N, D&gt;</code> will create a unique type associated with each value of <code>N</code> and <code>D</code>.  So <code>ratio&lt;4, 6&gt;</code> is a different type than <code>ratio&lt;2, 3&gt;</code>, even though they represent the same (reduced) fraction.  Do I always have to do the math to simplify the conversion factor to reduced terms?</p>
  
  <p>It would be more convenient to write:</p>
  
  <pre><code>using microfortnights = std::chrono::duration&lt;long, ratio&lt;86400*14, 1000000&gt;&gt;;
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>using microfortnights = std::chrono::duration&lt;long, ratio&lt;756, 625&gt;&gt;;
  </code></pre>
  
  <p>But then these would be two different types, instead of the same type.  The first expression is easier to inspect for correctness.  But there are many representations of this fraction, and the second is arguably canonical, and thus preferred.  If I have too many types wandering around my program which actually represent the same unit, then that may lead to unnecessary template code bloat.</p>