Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:09:31

0001 #ifndef BOOST_THREAD_TIME_HPP
0002 #define BOOST_THREAD_TIME_HPP
0003 //  (C) Copyright 2007 Anthony Williams 
0004 //
0005 //  Distributed under the Boost Software License, Version 1.0. (See
0006 //  accompanying file LICENSE_1_0.txt or copy at
0007 //  http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 #include <boost/date_time/time_clock.hpp>
0010 #include <boost/date_time/microsec_time_clock.hpp>
0011 #include <boost/date_time/posix_time/posix_time_types.hpp>
0012 
0013 #include <boost/config/abi_prefix.hpp>
0014 
0015 namespace boost
0016 {
0017     typedef boost::posix_time::ptime system_time;
0018     
0019     inline system_time get_system_time()
0020     {
0021 #if defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK)
0022         return boost::date_time::microsec_clock<system_time>::universal_time();
0023 #else // defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK)
0024         return boost::date_time::second_clock<system_time>::universal_time();
0025 #endif // defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK)
0026     }
0027 
0028     namespace detail
0029     {
0030         inline system_time get_system_time_sentinel()
0031         {
0032             return system_time(boost::posix_time::pos_infin);
0033         }
0034 
0035         inline unsigned long get_milliseconds_until(system_time const& target_time)
0036         {
0037             if(target_time.is_pos_infinity())
0038             {
0039                 return ~(unsigned long)0;
0040             }
0041             system_time const now=get_system_time();
0042             if(target_time<=now)
0043             {
0044                 return 0;
0045             }
0046             return static_cast<unsigned long>((target_time-now).total_milliseconds()+1);
0047         }
0048 
0049     }
0050     
0051 }
0052 
0053 #include <boost/config/abi_suffix.hpp>
0054 
0055 #endif