]> rtime.felk.cvut.cz Git - eurobot/public.git/blob - src/boost/boost/thread/pthread/timespec.hpp
Add subset of boost library headers needed for compilation on PowerPC
[eurobot/public.git] / src / boost / boost / thread / pthread / timespec.hpp
1 #ifndef BOOST_THREAD_PTHREAD_TIMESPEC_HPP
2 #define BOOST_THREAD_PTHREAD_TIMESPEC_HPP
3 //  (C) Copyright 2007-8 Anthony Williams 
4 //
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)
8
9 #include <boost/thread/thread_time.hpp>
10 #include <boost/date_time/posix_time/conversion.hpp>
11 #include <pthread.h>
12 #ifndef _WIN32
13 #include <unistd.h>
14 #endif
15
16 #include <boost/config/abi_prefix.hpp>
17
18 namespace boost
19 {
20     namespace detail
21     {
22         inline struct timespec get_timespec(boost::system_time const& abs_time)
23         {
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);
26             
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()));
29             return timeout;
30         }
31     }
32 }
33
34 #include <boost/config/abi_suffix.hpp>
35
36 #endif