| 1 | #ifndef POSIX_TIME_DURATION_HPP___ |
| 2 | #define POSIX_TIME_DURATION_HPP___ |
| 3 | |
| 4 | /* Copyright (c) 2002,2003 CrystalClear Software, Inc. |
| 5 | * Use, modification and distribution is subject to the |
| 6 | * Boost Software License, Version 1.0. (See accompanying |
| 7 | * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) |
| 8 | * Author: Jeff Garland |
| 9 | * $Date$ |
| 10 | */ |
| 11 | |
| 12 | #include <boost/date_time/compiler_config.hpp> |
| 13 | #include <boost/date_time/posix_time/posix_time_config.hpp> |
| 14 | |
| 15 | namespace boost { |
| 16 | namespace posix_time { |
| 17 | |
| 18 | //! Allows expression of durations as an hour count |
| 19 | /*! \ingroup time_basics |
| 20 | */ |
| 21 | class BOOST_SYMBOL_VISIBLE hours : public time_duration |
| 22 | { |
| 23 | public: |
| 24 | explicit hours(long h) : |
| 25 | time_duration(static_cast<hour_type>(h),0,0) |
| 26 | {} |
| 27 | }; |
| 28 | |
| 29 | //! Allows expression of durations as a minute count |
| 30 | /*! \ingroup time_basics |
| 31 | */ |
| 32 | class BOOST_SYMBOL_VISIBLE minutes : public time_duration |
| 33 | { |
| 34 | public: |
| 35 | explicit minutes(long m) : |
| 36 | time_duration(0,static_cast<min_type>(m),0) |
| 37 | {} |
| 38 | }; |
| 39 | |
| 40 | //! Allows expression of durations as a seconds count |
| 41 | /*! \ingroup time_basics |
| 42 | */ |
| 43 | class BOOST_SYMBOL_VISIBLE seconds : public time_duration |
| 44 | { |
| 45 | public: |
| 46 | explicit seconds(long s) : |
| 47 | time_duration(0,0,static_cast<sec_type>(s)) |
| 48 | {} |
| 49 | }; |
| 50 | |
| 51 | |
| 52 | //! Allows expression of durations as milli seconds |
| 53 | /*! \ingroup time_basics |
| 54 | */ |
| 55 | typedef date_time::subsecond_duration<time_duration,1000> millisec; |
| 56 | typedef date_time::subsecond_duration<time_duration,1000> milliseconds; |
| 57 | |
| 58 | //! Allows expression of durations as micro seconds |
| 59 | /*! \ingroup time_basics |
| 60 | */ |
| 61 | typedef date_time::subsecond_duration<time_duration,1000000> microsec; |
| 62 | typedef date_time::subsecond_duration<time_duration,1000000> microseconds; |
| 63 | |
| 64 | //This is probably not needed anymore... |
| 65 | #if defined(BOOST_DATE_TIME_HAS_NANOSECONDS) |
| 66 | |
| 67 | //! Allows expression of durations as nano seconds |
| 68 | /*! \ingroup time_basics |
| 69 | */ |
| 70 | typedef date_time::subsecond_duration<time_duration,1000000000> nanosec; |
| 71 | typedef date_time::subsecond_duration<time_duration,1000000000> nanoseconds; |
| 72 | |
| 73 | |
| 74 | #endif |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | } }//namespace posix_time |
| 80 | |
| 81 | |
| 82 | #endif |
| 83 | |
| 84 | |