posix_time_duration.hpp 1.9 KB

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