...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::log::attributes::basic_clock — A class of an attribute that makes an attribute value of the current date and time.
// In header: <boost/log/attributes/clock.hpp> template<typename TimeTraitsT> class basic_clock : public attribute { public: // types typedef TimeTraitsT::time_type value_type; // Generated value type. // member classes/structs/unions // Attribute factory implementation. struct impl : public attribute::impl { // public member functions virtual attribute_value get_value(); }; // public member functions basic_clock(); explicit basic_clock(cast_source const &); };
The attribute generates current time stamp as a value. The type of the attribute value is determined with time traits passed to the class template as a template parameter. The time traits provided by the library use boost::posix_time::ptime
as the time type.
Time traits also determine the way time is acquired. There are two types of time traits provided by the library: utc_time_traits
and local_time_traits
. The first returns UTC time, the second returns local time.
basic_clock
public member functionsbasic_clock();
Default constructor
explicit basic_clock(cast_source const & source);
Constructor for casting support