title: How to use military time to compute time interval
body: <p>I'm using R and am trying to compute the number of hours someone slept. Currently, the bed time and wake times are reported in military time, so when I use difftime(), the interval between sleeping at 9pm (21:00) and waking up at 7AM (07:00) ends up being 14 hours, instead of 10 hours. Can someone help me figure out what I need to do so that it gives me the correct time difference?</p>
  
  <p>Example data:</p>
  
  <pre><code>              bedtime                   waketime
  1             1899-12-31 01:00:00       1899-12-31 06:00:00
  2             1899-12-31 21:00:00       1899-12-31 07:00:00
  3             1899-12-31 22:00:00       1899-12-31 06:00:00
  </code></pre>
  
  <p>Script used: </p>
  
  <pre><code>difftime(PSQI$wakeup_3, PSQI$bedtime_1, units = "hours")
   [1]   5.00 -14.00 -16.00 
  </code></pre>
  
  <p>When what I would am looking for is </p>
  
  <pre><code>[1]   5.00  10.00  8.00 
  </code></pre>
  
  <p>Thank you to anyone who can help!</p>