Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:36

0001 #ifndef POSIX_TIME_DURATION_HPP___
0002 #define POSIX_TIME_DURATION_HPP___
0003 
0004 /* Copyright (c) 2002,2003, 2020 CrystalClear Software, Inc.
0005  * Use, modification and distribution is subject to the 
0006  * Boost Software License, Version 1.0. (See accompanying
0007  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
0008  * Author: Jeff Garland
0009  * $Date$
0010  */
0011 
0012 #include <boost/core/enable_if.hpp>
0013 #include <boost/date_time/compiler_config.hpp>
0014 #include <boost/date_time/posix_time/posix_time_config.hpp>
0015 #include <boost/numeric/conversion/cast.hpp>
0016 #include <boost/type_traits/is_integral.hpp>
0017 
0018 namespace boost {
0019 namespace posix_time {
0020 
0021   //! Allows expression of durations as an hour count
0022   //! The argument must be an integral type
0023   /*! \ingroup time_basics
0024    */
0025   class BOOST_SYMBOL_VISIBLE hours : public time_duration
0026   {
0027   public:
0028       template <typename T>
0029       BOOST_CXX14_CONSTEXPR explicit hours(T const& h,
0030           typename boost::enable_if<boost::is_integral<T>, void>::type* = BOOST_DATE_TIME_NULLPTR) :
0031       time_duration(numeric_cast<hour_type>(h), 0, 0)
0032     {}
0033   };
0034 
0035   //! Allows expression of durations as a minute count
0036   //! The argument must be an integral type
0037   /*! \ingroup time_basics
0038    */
0039   class BOOST_SYMBOL_VISIBLE minutes : public time_duration
0040   {
0041   public:
0042       template <typename T>
0043       BOOST_CXX14_CONSTEXPR explicit minutes(T const& m,
0044           typename boost::enable_if<boost::is_integral<T>, void>::type* = BOOST_DATE_TIME_NULLPTR) :
0045       time_duration(0, numeric_cast<min_type>(m),0)
0046     {}
0047   };
0048 
0049   //! Allows expression of durations as a seconds count
0050   //! The argument must be an integral type
0051   /*! \ingroup time_basics
0052    */
0053   class BOOST_SYMBOL_VISIBLE seconds : public time_duration
0054   {
0055   public:
0056       template <typename T>
0057       BOOST_CXX14_CONSTEXPR explicit seconds(T const& s,
0058           typename boost::enable_if<boost::is_integral<T>, void>::type* = BOOST_DATE_TIME_NULLPTR) :
0059       time_duration(0,0, numeric_cast<sec_type>(s))
0060     {}
0061   };
0062 
0063 
0064   //! Allows expression of durations as milli seconds
0065   /*! \ingroup time_basics
0066    */
0067   typedef date_time::subsecond_duration<time_duration,1000> millisec;
0068   typedef date_time::subsecond_duration<time_duration,1000> milliseconds;
0069 
0070   //! Allows expression of durations as micro seconds
0071   /*! \ingroup time_basics
0072    */
0073   typedef date_time::subsecond_duration<time_duration,1000000> microsec;
0074   typedef date_time::subsecond_duration<time_duration,1000000> microseconds;
0075 
0076   //This is probably not needed anymore...
0077 #if defined(BOOST_DATE_TIME_HAS_NANOSECONDS)
0078 
0079   //! Allows expression of durations as nano seconds
0080   /*! \ingroup time_basics
0081    */
0082   typedef date_time::subsecond_duration<time_duration,1000000000> nanosec;
0083   typedef date_time::subsecond_duration<time_duration,1000000000> nanoseconds;
0084 
0085 #endif
0086 
0087 } }//namespace posix_time
0088 
0089 
0090 #endif
0091