Chris@16: ////////////////////////////////////////////////////////////////////////////// Chris@16: // Chris@16: // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost Chris@16: // Software License, Version 1.0. (See accompanying file Chris@16: // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // See http://www.boost.org/libs/interprocess for documentation. Chris@16: // Chris@16: ////////////////////////////////////////////////////////////////////////////// Chris@16: Chris@16: #ifndef BOOST_INTERPROCESS_DETAIL_PTIME_TO_TIMESPEC_HPP Chris@16: #define BOOST_INTERPROCESS_DETAIL_PTIME_TO_TIMESPEC_HPP Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: namespace interprocess { Chris@16: Chris@16: namespace ipcdetail { Chris@16: Chris@16: inline timespec ptime_to_timespec (const boost::posix_time::ptime &tm) Chris@16: { Chris@16: const boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1)); Chris@16: boost::posix_time::time_duration duration (tm - epoch); Chris@16: timespec ts; Chris@16: ts.tv_sec = duration.total_seconds(); Chris@16: ts.tv_nsec = duration.total_nanoseconds() % 1000000000; Chris@16: return ts; Chris@16: } Chris@16: Chris@16: } //namespace ipcdetail { Chris@16: Chris@16: } //namespace interprocess { Chris@16: Chris@16: } //namespace boost { Chris@16: Chris@16: #endif //ifndef BOOST_INTERPROCESS_DETAIL_PTIME_TO_TIMESPEC_HPP