1 #ifndef BOOST_THREAD_PTHREAD_TIMESPEC_HPP
2 #define BOOST_THREAD_PTHREAD_TIMESPEC_HPP
3 // (C) Copyright 2007-8 Anthony Williams
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 #include <boost/thread/thread_time.hpp>
10 #include <boost/date_time/posix_time/conversion.hpp>
16 #include <boost/config/abi_prefix.hpp>
22 inline struct timespec
get_timespec(boost::system_time
const& abs_time
)
24 struct timespec timeout
={0,0};
25 boost::posix_time::time_duration
const time_since_epoch
=abs_time
-boost::posix_time::from_time_t(0);
27 timeout
.tv_sec
=time_since_epoch
.total_seconds();
28 timeout
.tv_nsec
=(long)(time_since_epoch
.fractional_seconds()*(1000000000l/time_since_epoch
.ticks_per_second()));
34 #include <boost/config/abi_suffix.hpp>