Boost C++ Libraries

PrevUpHomeNext

Class template basic_clock

boost::log::attributes::basic_clock — A class of an attribute that makes an attribute value of the current date and time.

Synopsis

// In header: <boost/log/attributes/clock.hpp>

template<typename TimeTraitsT> 
class basic_clock : public attribute {
public:
  // types
  typedef TimeTraitsT::time_type time_type;  // Time storage type. 

  // public member functions
  shared_ptr< attribute_value > get_value();
};

Description

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 th library: utc_time_traits and local_time_traits. The first returns UTC time, the second returns local time.

basic_clock public member functions

  1. shared_ptr< attribute_value > get_value();

    Returns:

    The actual attribute value. It shall not return NULL (exceptions shall be used to indicate errors).


PrevUpHomeNext