comparison 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
comparison
equal deleted inserted replaced
15:663ca0da4350 16:2665513ce2d3
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // See http://www.boost.org/libs/interprocess for documentation.
8 //
9 //////////////////////////////////////////////////////////////////////////////
10
11 #ifndef BOOST_INTERPROCESS_DETAIL_PTIME_TO_TIMESPEC_HPP
12 #define BOOST_INTERPROCESS_DETAIL_PTIME_TO_TIMESPEC_HPP
13
14 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
15
16 namespace boost {
17
18 namespace interprocess {
19
20 namespace ipcdetail {
21
22 inline timespec ptime_to_timespec (const boost::posix_time::ptime &tm)
23 {
24 const boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1));
25 boost::posix_time::time_duration duration (tm - epoch);
26 timespec ts;
27 ts.tv_sec = duration.total_seconds();
28 ts.tv_nsec = duration.total_nanoseconds() % 1000000000;
29 return ts;
30 }
31
32 } //namespace ipcdetail {
33
34 } //namespace interprocess {
35
36 } //namespace boost {
37
38 #endif //ifndef BOOST_INTERPROCESS_DETAIL_PTIME_TO_TIMESPEC_HPP