title: Convert int64_t to time_duration
body: <p>I would like to transfer a <code>boost::posix_time::ptime</code> over the network as a <code>boost::int64_t</code>. According to <a href="https://stackoverflow.com/questions/1574647/a-way-to-turn-boostposix-timeptime-into-an-int64">A way to turn boost::posix_time::ptime into an __int64</a>, I can easily define my own <em>epoch</em> and only transfer the <code>time_duration</code> from that reference epoch as a 64 bits integer. But how to convert back to a <code>ptime</code>?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cassert&gt;
  #include &lt;boost/date_time/posix_time/posix_time.hpp&gt;
  #include &lt;boost/date_time/gregorian/greg_month.hpp&gt;
  
  using namespace std;
  
  using boost::posix_time::ptime;
  using boost::posix_time::time_duration;
  using boost::gregorian::date;
  
  int main(int argc, char ** argv){
      ptime t = boost::posix_time::microsec_clock::local_time();
  
      // convert to int64_t
      ptime myEpoch(date(1970,boost::gregorian::Jan,1));
      time_duration myTimeFromEpoch = t - myEpoch;
      boost::int64_t myTimeAsInt = myTimeFromEpoch.ticks();
  
      // convert back to ptime
      ptime test = myEpoch + time_duration(myTimeAsInt);
  
      assert(test == t);
      return 0;
  }
  </code></pre>
  
  <p>This is not working since the <code>time_duration</code> constructor taking a tick count as argument is private. I am also interested in any other way to simply transfer that <code>ptime</code> over simple data types.</p>