1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- #ifndef BOOST_LOG_ATTRIBUTES_CLOCK_HPP_INCLUDED_
- #define BOOST_LOG_ATTRIBUTES_CLOCK_HPP_INCLUDED_
- #include <boost/log/detail/config.hpp>
- #include <boost/log/attributes/attribute.hpp>
- #include <boost/log/attributes/attribute_value.hpp>
- #include <boost/log/attributes/attribute_cast.hpp>
- #include <boost/log/attributes/attribute_value_impl.hpp>
- #include <boost/log/attributes/time_traits.hpp>
- #include <boost/log/detail/header.hpp>
- #ifdef BOOST_HAS_PRAGMA_ONCE
- #pragma once
- #endif
- namespace boost {
- BOOST_LOG_OPEN_NAMESPACE
- namespace attributes {
- template< typename TimeTraitsT >
- class basic_clock :
- public attribute
- {
- public:
-
- typedef typename TimeTraitsT::time_type value_type;
- protected:
-
- struct BOOST_SYMBOL_VISIBLE impl :
- public attribute::impl
- {
- attribute_value get_value()
- {
- typedef attribute_value_impl< value_type > result_value;
- return attribute_value(new result_value(TimeTraitsT::get_clock()));
- }
- };
- public:
-
- basic_clock() : attribute(new impl())
- {
- }
-
- explicit basic_clock(cast_source const& source) : attribute(source.as< impl >())
- {
- }
- };
- typedef basic_clock< utc_time_traits > utc_clock;
- typedef basic_clock< local_time_traits > local_clock;
- }
- BOOST_LOG_CLOSE_NAMESPACE
- }
- #include <boost/log/detail/footer.hpp>
- #endif
|