Mercurial > hg > vamp-build-and-test
annotate DEPENDENCIES/generic/include/boost/interprocess/sync/posix/ptime_to_timespec.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
rev | line source |
---|---|
Chris@16 | 1 ////////////////////////////////////////////////////////////////////////////// |
Chris@16 | 2 // |
Chris@16 | 3 // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost |
Chris@16 | 4 // Software License, Version 1.0. (See accompanying file |
Chris@16 | 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
Chris@16 | 6 // |
Chris@16 | 7 // See http://www.boost.org/libs/interprocess for documentation. |
Chris@16 | 8 // |
Chris@16 | 9 ////////////////////////////////////////////////////////////////////////////// |
Chris@16 | 10 |
Chris@16 | 11 #ifndef BOOST_INTERPROCESS_DETAIL_PTIME_TO_TIMESPEC_HPP |
Chris@16 | 12 #define BOOST_INTERPROCESS_DETAIL_PTIME_TO_TIMESPEC_HPP |
Chris@16 | 13 |
Chris@16 | 14 #include <boost/interprocess/detail/posix_time_types_wrk.hpp> |
Chris@16 | 15 |
Chris@16 | 16 namespace boost { |
Chris@16 | 17 |
Chris@16 | 18 namespace interprocess { |
Chris@16 | 19 |
Chris@16 | 20 namespace ipcdetail { |
Chris@16 | 21 |
Chris@16 | 22 inline timespec ptime_to_timespec (const boost::posix_time::ptime &tm) |
Chris@16 | 23 { |
Chris@16 | 24 const boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1)); |
Chris@16 | 25 boost::posix_time::time_duration duration (tm - epoch); |
Chris@16 | 26 timespec ts; |
Chris@16 | 27 ts.tv_sec = duration.total_seconds(); |
Chris@16 | 28 ts.tv_nsec = duration.total_nanoseconds() % 1000000000; |
Chris@16 | 29 return ts; |
Chris@16 | 30 } |
Chris@16 | 31 |
Chris@16 | 32 } //namespace ipcdetail { |
Chris@16 | 33 |
Chris@16 | 34 } //namespace interprocess { |
Chris@16 | 35 |
Chris@16 | 36 } //namespace boost { |
Chris@16 | 37 |
Chris@16 | 38 #endif //ifndef BOOST_INTERPROCESS_DETAIL_PTIME_TO_TIMESPEC_HPP |