title: Comparing timespec values
body: <p>What's the best way to compare two timespec values to see which happened first?</p>
  
  <p>Is there anything wrong with the following?</p>
  
  <pre><code>bool BThenA(timespec a, timespec b) {
      //Returns true if b happened first -- b will be "lower".
      if (a.tv_sec == b.tv_sec)
          return a.tv_nsec &gt; b.tv_nsec;
      else
          return a.tv_sec &gt; b.tv_sec;
  }
  </code></pre>