1 #ifndef BOOST_THREAD_TIME_HPP
2 #define BOOST_THREAD_TIME_HPP
3 // (C) Copyright 2007 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/date_time/microsec_time_clock.hpp>
10 #include <boost/date_time/posix_time/posix_time_types.hpp>
12 #include <boost/config/abi_prefix.hpp>
16 typedef boost::posix_time::ptime system_time
;
18 inline system_time
get_system_time()
20 return boost::date_time::microsec_clock
<system_time
>::universal_time();
25 inline system_time
get_system_time_sentinel()
27 return system_time(boost::posix_time::pos_infin
);
30 inline unsigned long get_milliseconds_until(system_time
const& target_time
)
32 if(target_time
.is_pos_infinity())
34 return ~(unsigned long)0;
36 system_time
const now
=get_system_time();
41 return static_cast<unsigned long>((target_time
-now
).total_milliseconds()+1);
48 #include <boost/config/abi_suffix.hpp>