fix doc example typo
[boost.git] / boost / thread / thread_time.hpp
blob8b557d5c387a86d0a7392f3745be3f3d97747ea1
1 #ifndef BOOST_THREAD_TIME_HPP
2 #define BOOST_THREAD_TIME_HPP
3 // (C) Copyright 2007 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)
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>
14 namespace boost
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();
23 namespace detail
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();
37 if(target_time<=now)
39 return 0;
41 return static_cast<unsigned long>((target_time-now).total_milliseconds()+1);
48 #include <boost/config/abi_suffix.hpp>
50 #endif