Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

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 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 &);
};

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

basic_clock public member functions

  1. basic_clock();

    Default constructor

  2. explicit basic_clock(cast_source const & source);

    Constructor for casting support


PrevUpHomeNext