2 * Copyright Andrey Semashev 2007 - 2015.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
8 * \file date_time_types.hpp
9 * \author Andrey Semashev
12 * The header contains definition of date and time-related types supported by the library by default.
15 #ifndef BOOST_LOG_DATE_TIME_TYPES_HPP_INCLUDED_
16 #define BOOST_LOG_DATE_TIME_TYPES_HPP_INCLUDED_
19 #include <boost/mpl/vector.hpp>
20 #include <boost/preprocessor/seq/enum.hpp>
21 #include <boost/date_time/gregorian/gregorian_types.hpp>
22 #include <boost/date_time/local_time/local_time_types.hpp>
23 #include <boost/date_time/posix_time/posix_time_types.hpp>
24 #include <boost/log/detail/config.hpp>
25 #include <boost/log/detail/header.hpp>
27 #ifdef BOOST_HAS_PRAGMA_ONCE
33 BOOST_LOG_OPEN_NAMESPACE
35 //! Boost.Preprocessor sequence of the standard C date/time types
36 #define BOOST_LOG_NATIVE_DATE_TIME_TYPES()\
37 (std::time_t)(std::tm)
39 //! Boost.Preprocessor sequence of the standard C date types
40 #define BOOST_LOG_NATIVE_DATE_TYPES()\
41 BOOST_LOG_NATIVE_DATE_TIME_TYPES()
43 //! Boost.Preprocessor sequence of the Boost date/time types
44 #define BOOST_LOG_BOOST_DATE_TIME_TYPES()\
45 (boost::posix_time::ptime)(boost::local_time::local_date_time)
47 //! Boost.Preprocessor sequence of date/time types
48 #define BOOST_LOG_DATE_TIME_TYPES()\
49 BOOST_LOG_NATIVE_DATE_TIME_TYPES()BOOST_LOG_BOOST_DATE_TIME_TYPES()\
51 //! Boost.Preprocessor sequence of the Boost date types
52 #define BOOST_LOG_BOOST_DATE_TYPES()\
53 BOOST_LOG_BOOST_DATE_TIME_TYPES()(boost::gregorian::date)
55 //! Boost.Preprocessor sequence of date types
56 #define BOOST_LOG_DATE_TYPES()\
57 BOOST_LOG_NATIVE_DATE_TYPES()BOOST_LOG_BOOST_DATE_TYPES()
60 //! Boost.Preprocessor sequence of the standard time duration types
61 #define BOOST_LOG_NATIVE_TIME_DURATION_TYPES()\
62 (double) /* result of difftime() */
64 //! Boost.Preprocessor sequence of the Boost time duration types
65 #define BOOST_LOG_BOOST_TIME_DURATION_TYPES()\
66 (boost::posix_time::time_duration)(boost::gregorian::date_duration)
68 //! Boost.Preprocessor sequence of time duration types
69 #define BOOST_LOG_TIME_DURATION_TYPES()\
70 BOOST_LOG_NATIVE_TIME_DURATION_TYPES()BOOST_LOG_BOOST_TIME_DURATION_TYPES()
73 //! Boost.Preprocessor sequence of the Boost time period types
74 #define BOOST_LOG_BOOST_TIME_PERIOD_TYPES()\
75 (boost::posix_time::time_period)(boost::local_time::local_time_period)(boost::gregorian::date_period)
77 //! Boost.Preprocessor sequence of time period types
78 #define BOOST_LOG_TIME_PERIOD_TYPES()\
79 BOOST_LOG_BOOST_TIME_PERIOD_TYPES()
83 * An MPL-sequence of natively supported date and time types of attributes
86 BOOST_PP_SEQ_ENUM(BOOST_LOG_NATIVE_DATE_TIME_TYPES())
87 > native_date_time_types;
90 * An MPL-sequence of Boost date and time types of attributes
93 BOOST_PP_SEQ_ENUM(BOOST_LOG_BOOST_DATE_TIME_TYPES())
94 > boost_date_time_types;
97 * An MPL-sequence with the complete list of the supported date and time types
100 BOOST_PP_SEQ_ENUM(BOOST_LOG_DATE_TIME_TYPES())
104 * An MPL-sequence of natively supported date types of attributes
106 typedef native_date_time_types native_date_types;
109 * An MPL-sequence of Boost date types of attributes
112 BOOST_PP_SEQ_ENUM(BOOST_LOG_BOOST_DATE_TYPES())
116 * An MPL-sequence with the complete list of the supported date types
119 BOOST_PP_SEQ_ENUM(BOOST_LOG_DATE_TYPES())
123 * An MPL-sequence of natively supported time types
125 typedef native_date_time_types native_time_types;
127 //! An MPL-sequence of Boost time types
128 typedef boost_date_time_types boost_time_types;
131 * An MPL-sequence with the complete list of the supported time types
133 typedef date_time_types time_types;
136 * An MPL-sequence of natively supported time duration types of attributes
139 BOOST_PP_SEQ_ENUM(BOOST_LOG_NATIVE_TIME_DURATION_TYPES())
140 > native_time_duration_types;
143 * An MPL-sequence of Boost time duration types of attributes
146 BOOST_PP_SEQ_ENUM(BOOST_LOG_BOOST_TIME_DURATION_TYPES())
147 > boost_time_duration_types;
150 * An MPL-sequence with the complete list of the supported time duration types
153 BOOST_PP_SEQ_ENUM(BOOST_LOG_TIME_DURATION_TYPES())
154 > time_duration_types;
157 * An MPL-sequence of Boost time duration types of attributes
160 BOOST_PP_SEQ_ENUM(BOOST_LOG_BOOST_TIME_PERIOD_TYPES())
161 > boost_time_period_types;
164 * An MPL-sequence with the complete list of the supported time period types
166 typedef boost_time_period_types time_period_types;
168 BOOST_LOG_CLOSE_NAMESPACE // namespace log
172 #include <boost/log/detail/footer.hpp>
174 #endif // BOOST_LOG_DATE_TIME_TYPES_HPP_INCLUDED_