3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Class template basic_clock</title>
5 <link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
7 <link rel="home" href="../../../index.html" title="Chapter 1. Boost.Log v2">
8 <link rel="up" href="../../../attributes.html#header.boost.log.attributes.clock_hpp" title="Header <boost/log/attributes/clock.hpp>">
9 <link rel="prev" href="../swap_idp35227776.html" title="Function swap">
10 <link rel="next" href="basic_clock/impl.html" title="Struct impl">
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr><td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td></tr></table>
15 <div class="spirit-nav">
16 <a accesskey="p" href="../swap_idp35227776.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../attributes.html#header.boost.log.attributes.clock_hpp"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="basic_clock/impl.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
18 <div class="refentry">
19 <a name="boost.log.attributes.basic_clock"></a><div class="titlepage"></div>
20 <div class="refnamediv">
21 <h2><span class="refentrytitle">Class template basic_clock</span></h2>
22 <p>boost::log::attributes::basic_clock — A class of an attribute that makes an attribute value of the current date and time. </p>
24 <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
25 <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../../attributes.html#header.boost.log.attributes.clock_hpp" title="Header <boost/log/attributes/clock.hpp>">boost/log/attributes/clock.hpp</a>>
27 </span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> TimeTraitsT<span class="special">></span>
28 <span class="keyword">class</span> <a class="link" href="basic_clock.html" title="Class template basic_clock">basic_clock</a> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">attribute</span> <span class="special">{</span>
29 <span class="keyword">public</span><span class="special">:</span>
30 <span class="comment">// types</span>
31 <span class="keyword">typedef</span> <span class="identifier">TimeTraitsT</span><span class="special">::</span><span class="identifier">time_type</span> <a name="boost.log.attributes.basic_clock.value_type"></a><span class="identifier">value_type</span><span class="special">;</span> <span class="comment">// Generated value type. </span>
33 <span class="comment">// member classes/structs/unions</span>
35 <span class="comment">// Attribute factory implementation.</span>
37 <span class="keyword">struct</span> <a class="link" href="basic_clock/impl.html" title="Struct impl">impl</a> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">attribute</span><span class="special">::</span><span class="identifier">impl</span> <span class="special">{</span>
39 <span class="comment">// <a class="link" href="basic_clock/impl.html#idp35241488-bb">public member functions</a></span>
40 <span class="keyword">virtual</span> <a class="link" href="../attribute_value.html" title="Class attribute_value">attribute_value</a> <a class="link" href="basic_clock/impl.html#idp35242048-bb"><span class="identifier">get_value</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
41 <span class="special">}</span><span class="special">;</span>
43 <span class="comment">// <a class="link" href="basic_clock.html#boost.log.attributes.basic_clockconstruct-copy-destruct">construct/copy/destruct</a></span>
44 <a class="link" href="basic_clock.html#idp35246240-bb"><span class="identifier">basic_clock</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
45 <span class="keyword">explicit</span> <a class="link" href="basic_clock.html#idp35246944-bb"><span class="identifier">basic_clock</span></a><span class="special">(</span><a class="link" href="cast_source.html" title="Class cast_source">cast_source</a> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
46 <span class="special">}</span><span class="special">;</span></pre></div>
47 <div class="refsect1">
48 <a name="idp89268720"></a><h2>Description</h2>
49 <p>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 <code class="computeroutput">boost::posix_time::ptime</code> as the time type.</p>
50 <p>Time traits also determine the way time is acquired. There are two types of time traits provided by the library: <code class="computeroutput"><a class="link" href="utc_time_traits.html" title="Struct utc_time_traits">utc_time_traits</a></code> and <code class="computeroutput"><a class="link" href="local_time_traits.html" title="Struct local_time_traits">local_time_traits</a></code>. The first returns UTC time, the second returns local time. </p>
51 <div class="refsect2">
52 <a name="idp89273328"></a><h3>
53 <a name="boost.log.attributes.basic_clockconstruct-copy-destruct"></a><code class="computeroutput">basic_clock</code>
55 construct/copy/destruct</h3>
56 <div class="orderedlist"><ol class="orderedlist" type="1">
58 <pre class="literallayout"><a name="idp35246240-bb"></a><span class="identifier">basic_clock</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
59 <p>Default constructor </p>
62 <pre class="literallayout"><span class="keyword">explicit</span> <a name="idp35246944-bb"></a><span class="identifier">basic_clock</span><span class="special">(</span><a class="link" href="cast_source.html" title="Class cast_source">cast_source</a> <span class="keyword">const</span> <span class="special">&</span> source<span class="special">)</span><span class="special">;</span></pre>
63 <p>Constructor for casting support </p>
69 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
70 <td align="left"></td>
71 <td align="right"><div class="copyright-footer">Copyright © 2007-2014 Andrey Semashev<p>
72 Distributed under the Boost Software License, Version 1.0. (See accompanying
73 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>).
78 <div class="spirit-nav">
79 <a accesskey="p" href="../swap_idp35227776.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../attributes.html#header.boost.log.attributes.clock_hpp"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="basic_clock/impl.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>