title: CMTimeClampToRange() doesn't seem to return a CMTime that's inside the given range
body: <p>I have the following code in my project:</p>
  
  <pre><code>CMTimeRange clipRange = clip.range;
  CMTime clipTime = CMTimeClampToRange(editor.currentClipTime, clipRange);
  </code></pre>
  
  <p>According to the <a href="https://developer.apple.com/library/mac/documentation/CoreMedia/Reference/CMTimeRange/index.html#//apple_ref/c/func/CMTimeClampToRange" rel="nofollow">documentation</a>, <code>CMTimeClampToRange()</code> should behave like:</p>
  
  <blockquote>
    <p>For a given <code>CMTime</code> and <code>CMTimeRange</code>, returns the nearest <code>CMTime</code> inside that time range.</p>
  </blockquote>
  
  <p>However, when I add this:</p>
  
  <pre><code>assert(CMTimeRangeContainsTime(clipRange, clipTime));
  </code></pre>
  
  <p>The assertion fails. The documentation for <code>CMTimeRangeContainsTime()</code> states:</p>
  
  <blockquote>
    <p>Indicates whether a time is contained within a time range.</p>
  </blockquote>
  
  <p>I would assume that <em>inside</em> and <em>within</em> mean the same, but apparently it doesn't; is there an elegant way to clamp a <code>CMTime</code> in a range so that it satisfies <code>CMTimeRangeContainsTime()</code>?</p>