## Class timer

boost::log::attributes::timer — A class of an attribute that makes an attribute value of the time interval since construction.

## Synopsis

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

    class timer : public attribute {
    public:
      // types
      typedef utc_time_traits::time_type::time_duration_type value_type;  // Attribute value type.

      // construct/copy/destruct
      timer();
      explicit timer(cast_source const &);
    };

## Description

The timer attribute calculates the time passed since its construction and returns it on value acquisition. The attribute value type is `boost::posix_time::time_duration`.

On Windows platform there are two implementations of the attribute. The default one is more precise but a bit slower. This version uses `QueryPerformanceFrequence`/`QueryPerformanceCounter` API to calculate elapsed time.

There are known problems with these functions when used with some CPUs, notably AMD Athlon with Cool'n'Quiet technology enabled. See the following links for more information and possible resolutions:

http://support.microsoft.com/?scid=kb;en-us;895980 http://support.microsoft.com/?id=896256

In case if none of these solutions apply, you are free to define `BOOST_LOG_NO_QUERY_PERFORMANCE_COUNTER` macro to fall back to another implementation based on Boost.DateTime.

### `timer` public construct/copy/destruct

1.     timer();

   Constructor. Starts time counting.

2.     explicit timer(cast_source const & source);

   Constructor for casting support