title: Checking if time_t is between other time_t with some margin of error
body: <p>I have two time_t variables: timeA and timeB.</p>
  
  <p>What I want to do is check if timeA is the same as timeB. However, I know that in some cases they won't be exactly the same and there may be a 1 or 2 seconds difference between the two of them, so what I really want to check is:</p>
  
  <pre><code>    if (timeB - 2sec) &lt;= timeA &lt;= (timeB + 2sec)
  </code></pre>
  
  <p>Is it possible to do so? </p>
  
  <p>I suppose one option is not to use time_t but instead keep timeB as a tm struct, and just before the comparison, subtract two seconds and create a time_t timeBminus and then add four seconds and create time_t timeBplus. The problem is that I will be comparing several millions of timeA - timeB pairs and want to keep it as simple and fast as possible.</p>
  
  <p>How can I do it?</p>