title: boost::posix_time::time_duration overflow?
body: <p>I have the following code to get the UNIX time from a posix_time</p>
  
  <pre><code>boost::posix_time::ptime time1(boost::gregorian::date(9999,12,31));
  boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1));
  
  boost::posix_time::time_duration diff = time1-epoch;
  cout&lt;&lt;"A: "&lt;&lt;time1&lt;&lt;endl;
  cout&lt;&lt;"B: "&lt;&lt;epoch&lt;&lt;endl;
  cout&lt;&lt;"C: "&lt;&lt;diff&lt;&lt;endl;
  
  unix_time = diff.total_seconds()
  </code></pre>
  
  <p>gives me this output</p>
  
  <pre><code>9999-Dec-31 00:00:00
  1970-Jan-01 00:00:00
  -1347834:03:51.933722624
  </code></pre>
  
  <p>Now <code>diff</code> should not be a negative number. How can I calculate that right? Is there an overflow?</p>