1 | <html> |
---|
2 | <head> |
---|
3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
---|
4 | <title>Class template time_duration</title> |
---|
5 | <link rel="stylesheet" href="boostbook.css" type="text/css"> |
---|
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.68.1"> |
---|
7 | <link rel="start" href="index.html" title="The Boost C++ Libraries"> |
---|
8 | <link rel="up" href="date_time/doxy.html#id863086" title="Header <boost/date_time/time_duration.hpp>"> |
---|
9 | <link rel="prev" href="second_clock.html" title="Class template second_clock"> |
---|
10 | <link rel="next" href="subsecond_duration.html" title="Class template subsecond_duration"> |
---|
11 | </head> |
---|
12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
---|
13 | <table cellpadding="2" width="100%"> |
---|
14 | <td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../boost.png"></td> |
---|
15 | <td align="center"><a href="../../index.htm">Home</a></td> |
---|
16 | <td align="center"><a href="../../libs/libraries.htm">Libraries</a></td> |
---|
17 | <td align="center"><a href="../../people/people.htm">People</a></td> |
---|
18 | <td align="center"><a href="../../more/faq.htm">FAQ</a></td> |
---|
19 | <td align="center"><a href="../../more/index.htm">More</a></td> |
---|
20 | </table> |
---|
21 | <hr> |
---|
22 | <div class="spirit-nav"> |
---|
23 | <a accesskey="p" href="second_clock.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="date_time/doxy.html#id863086"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="subsecond_duration.html"><img src="images/next.png" alt="Next"></a> |
---|
24 | </div> |
---|
25 | <div class="refentry" lang="en"> |
---|
26 | <a name="id757440"></a><div class="titlepage"></div> |
---|
27 | <div class="refnamediv"> |
---|
28 | <h2><span class="refentrytitle">Class template time_duration</span></h2> |
---|
29 | <p>boost::date_time::time_duration — Represents some amount of elapsed time measure to a given resolution. </p> |
---|
30 | </div> |
---|
31 | <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> |
---|
32 | <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T, <span class="bold"><strong>typename</strong></span> rep_type> |
---|
33 | <span class="bold"><strong>class</strong></span> time_duration { |
---|
34 | <span class="bold"><strong>public</strong></span>: |
---|
35 | <span class="emphasis"><em>// types</em></span> |
---|
36 | <span class="bold"><strong>typedef</strong></span> T duration_type; |
---|
37 | <span class="bold"><strong>typedef</strong></span> rep_type traits_type; |
---|
38 | <span class="bold"><strong>typedef</strong></span> rep_type::day_type day_type; |
---|
39 | <span class="bold"><strong>typedef</strong></span> rep_type::hour_type hour_type; |
---|
40 | <span class="bold"><strong>typedef</strong></span> rep_type::min_type min_type; |
---|
41 | <span class="bold"><strong>typedef</strong></span> rep_type::sec_type sec_type; |
---|
42 | <span class="bold"><strong>typedef</strong></span> rep_type::fractional_seconds_type fractional_seconds_type; |
---|
43 | <span class="bold"><strong>typedef</strong></span> rep_type::tick_type tick_type; |
---|
44 | <span class="bold"><strong>typedef</strong></span> rep_type::impl_type impl_type; |
---|
45 | |
---|
46 | <span class="emphasis"><em>// <a href="id757440.html#id757440construct-copy-destruct">construct/copy/destruct</a></em></span> |
---|
47 | <a href="id757440.html#id795397-bb">time_duration</a>(); |
---|
48 | <a href="id757440.html#id795400-bb">time_duration</a>(hour_type, min_type, sec_type = 0, |
---|
49 | fractional_seconds_type = 0); |
---|
50 | <a href="id757440.html#id795454-bb">time_duration</a>(<span class="bold"><strong>const</strong></span> <a href="id757440.html" title="Class template time_duration">time_duration</a>< T, rep_type > &); |
---|
51 | <a href="id757440.html#id795477-bb">time_duration</a>(special_values); |
---|
52 | <a href="id757440.html#id798696-bb">time_duration</a>(impl_type); |
---|
53 | |
---|
54 | <span class="emphasis"><em>// <a href="id757440.html#id828334-bb">public member functions</a></em></span> |
---|
55 | <span class="type">hour_type</span> <a href="id757440.html#id828340-bb">hours</a>() <span class="bold"><strong>const</strong></span>; |
---|
56 | <span class="type">min_type</span> <a href="id757440.html#id828357-bb">minutes</a>() <span class="bold"><strong>const</strong></span>; |
---|
57 | <span class="type">sec_type</span> <a href="id757440.html#id828374-bb">seconds</a>() <span class="bold"><strong>const</strong></span>; |
---|
58 | <span class="type">sec_type</span> <a href="id757440.html#id828392-bb">total_seconds</a>() <span class="bold"><strong>const</strong></span>; |
---|
59 | <span class="type">tick_type</span> <a href="id757440.html#id828410-bb">total_milliseconds</a>() <span class="bold"><strong>const</strong></span>; |
---|
60 | <span class="type">tick_type</span> <a href="id757440.html#id828428-bb">total_nanoseconds</a>() <span class="bold"><strong>const</strong></span>; |
---|
61 | <span class="type">tick_type</span> <a href="id757440.html#id828446-bb">total_microseconds</a>() <span class="bold"><strong>const</strong></span>; |
---|
62 | <span class="type">fractional_seconds_type</span> <a href="id757440.html#id828464-bb">fractional_seconds</a>() <span class="bold"><strong>const</strong></span>; |
---|
63 | <span class="type">duration_type</span> <a href="id757440.html#id828482-bb">invert_sign</a>() <span class="bold"><strong>const</strong></span>; |
---|
64 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="id757440.html#id828495-bb">is_negative</a>() <span class="bold"><strong>const</strong></span>; |
---|
65 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="id757440.html#id892029-bb"><span class="bold"><strong>operator</strong></span><</a>(<span class="bold"><strong>const</strong></span> <a href="id757440.html" title="Class template time_duration">time_duration</a> &) <span class="bold"><strong>const</strong></span>; |
---|
66 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="id757440.html#id693905-bb"><span class="bold"><strong>operator</strong></span>==</a>(<span class="bold"><strong>const</strong></span> <a href="id757440.html" title="Class template time_duration">time_duration</a> &) <span class="bold"><strong>const</strong></span>; |
---|
67 | <span class="type">duration_type</span> <a href="id757440.html#id862511-bb"><span class="bold"><strong>operator</strong></span>-</a>() <span class="bold"><strong>const</strong></span>; |
---|
68 | <span class="type">duration_type</span> <a href="id757440.html#id828940-bb"><span class="bold"><strong>operator</strong></span>-</a>(<span class="bold"><strong>const</strong></span> duration_type &) <span class="bold"><strong>const</strong></span>; |
---|
69 | <span class="type">duration_type</span> <a href="id757440.html#id828964-bb"><span class="bold"><strong>operator</strong></span>+</a>(<span class="bold"><strong>const</strong></span> duration_type &) <span class="bold"><strong>const</strong></span>; |
---|
70 | <span class="type">duration_type</span> <a href="id757440.html#id828987-bb"><span class="bold"><strong>operator</strong></span>/</a>(<span class="bold"><strong>int</strong></span>) <span class="bold"><strong>const</strong></span>; |
---|
71 | <span class="type">duration_type</span> <a href="id757440.html#id829086-bb"><span class="bold"><strong>operator</strong></span>-=</a>(<span class="bold"><strong>const</strong></span> duration_type &) ; |
---|
72 | <span class="type">duration_type</span> <a href="id757440.html#id829110-bb"><span class="bold"><strong>operator</strong></span>+=</a>(<span class="bold"><strong>const</strong></span> duration_type &) ; |
---|
73 | <span class="type">duration_type</span> <a href="id757440.html#id837255-bb"><span class="bold"><strong>operator</strong></span>/=</a>(<span class="bold"><strong>int</strong></span>) ; |
---|
74 | <span class="type">duration_type</span> <a href="id757440.html#id829509-bb"><span class="bold"><strong>operator</strong></span> *</a>(<span class="bold"><strong>int</strong></span>) <span class="bold"><strong>const</strong></span>; |
---|
75 | <span class="type">duration_type</span> <a href="id757440.html#id689922-bb"><span class="bold"><strong>operator</strong></span> *=</a>(<span class="bold"><strong>int</strong></span>) ; |
---|
76 | <span class="type">tick_type</span> <a href="id757440.html#id870539-bb">ticks</a>() <span class="bold"><strong>const</strong></span>; |
---|
77 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="id757440.html#id870552-bb">is_special</a>() <span class="bold"><strong>const</strong></span>; |
---|
78 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="id757440.html#id870569-bb">is_pos_infinity</a>() <span class="bold"><strong>const</strong></span>; |
---|
79 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="id757440.html#id799594-bb">is_neg_infinity</a>() <span class="bold"><strong>const</strong></span>; |
---|
80 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="id757440.html#id799611-bb">is_not_a_date_time</a>() <span class="bold"><strong>const</strong></span>; |
---|
81 | <span class="type">impl_type</span> <a href="id757440.html#id828518-bb">get_rep</a>() <span class="bold"><strong>const</strong></span>; |
---|
82 | |
---|
83 | <span class="emphasis"><em>// <a href="id757440.html#id795496-bb">public static functions</a></em></span> |
---|
84 | <span class="type">duration_type</span> <a href="id757440.html#id795501-bb">unit</a>() ; |
---|
85 | <span class="type">tick_type</span> <a href="id757440.html#id795519-bb">ticks_per_second</a>() ; |
---|
86 | <span class="type">time_resolutions</span> <a href="id757440.html#id795536-bb">resolution</a>() ; |
---|
87 | <span class="type"><span class="bold"><strong>unsigned</strong></span> <span class="bold"><strong>short</strong></span></span> <a href="id757440.html#id798672-bb">num_fractional_digits</a>() ; |
---|
88 | |
---|
89 | <span class="emphasis"><em>// <a href="id757440.html#id798691-bb">protected member functions</a></em></span> |
---|
90 | };</pre></div> |
---|
91 | <div class="refsect1" lang="en"> |
---|
92 | <a name="id1136066"></a><h2>Description</h2> |
---|
93 | <p>This class represents a standard set of capabilities for all counted time durations. Time duration implementations should derive from this class passing their type as the first template parameter. This design allows the subclass duration types to provide custom construction policies or other custom features not provided here.</p> |
---|
94 | <p></p> |
---|
95 | <div class="refsect2" lang="en"> |
---|
96 | <a name="id1136078"></a><h3> |
---|
97 | <a name="id757440construct-copy-destruct"></a><code class="computeroutput">time_duration</code> construct/copy/destruct</h3> |
---|
98 | <div class="orderedlist"><ol type="1"> |
---|
99 | <li><pre class="literallayout"><a name="id795397-bb"></a>time_duration();</pre></li> |
---|
100 | <li><pre class="literallayout"><a name="id795400-bb"></a>time_duration(hour_type hours, min_type minutes, sec_type seconds = 0, |
---|
101 | fractional_seconds_type frac_sec = 0);</pre></li> |
---|
102 | <li><pre class="literallayout"><a name="id795454-bb"></a>time_duration(<span class="bold"><strong>const</strong></span> <a href="id757440.html" title="Class template time_duration">time_duration</a>< T, rep_type > & other);</pre></li> |
---|
103 | <li><pre class="literallayout"><a name="id795477-bb"></a>time_duration(special_values sv);</pre></li> |
---|
104 | <li><pre class="literallayout"><a name="id798696-bb"></a>time_duration(impl_type in);</pre></li> |
---|
105 | </ol></div> |
---|
106 | </div> |
---|
107 | <div class="refsect2" lang="en"> |
---|
108 | <a name="id1136180"></a><h3> |
---|
109 | <a name="id828334-bb"></a><code class="computeroutput">time_duration</code> public member functions</h3> |
---|
110 | <div class="orderedlist"><ol type="1"> |
---|
111 | <li><pre class="literallayout"><span class="type">hour_type</span> <a name="id828340-bb"></a>hours() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
112 | <li><pre class="literallayout"><span class="type">min_type</span> <a name="id828357-bb"></a>minutes() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
113 | <li><pre class="literallayout"><span class="type">sec_type</span> <a name="id828374-bb"></a>seconds() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
114 | <li><pre class="literallayout"><span class="type">sec_type</span> <a name="id828392-bb"></a>total_seconds() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
115 | <li><pre class="literallayout"><span class="type">tick_type</span> <a name="id828410-bb"></a>total_milliseconds() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
116 | <li><pre class="literallayout"><span class="type">tick_type</span> <a name="id828428-bb"></a>total_nanoseconds() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
117 | <li><pre class="literallayout"><span class="type">tick_type</span> <a name="id828446-bb"></a>total_microseconds() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
118 | <li><pre class="literallayout"><span class="type">fractional_seconds_type</span> <a name="id828464-bb"></a>fractional_seconds() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
119 | <li><pre class="literallayout"><span class="type">duration_type</span> <a name="id828482-bb"></a>invert_sign() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
120 | <li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id828495-bb"></a>is_negative() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
121 | <li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id892029-bb"></a><span class="bold"><strong>operator</strong></span><(<span class="bold"><strong>const</strong></span> <a href="id757440.html" title="Class template time_duration">time_duration</a> & rhs) <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
122 | <li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id693905-bb"></a><span class="bold"><strong>operator</strong></span>==(<span class="bold"><strong>const</strong></span> <a href="id757440.html" title="Class template time_duration">time_duration</a> & rhs) <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
123 | <li><pre class="literallayout"><span class="type">duration_type</span> <a name="id862511-bb"></a><span class="bold"><strong>operator</strong></span>-() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
124 | <li><pre class="literallayout"><span class="type">duration_type</span> <a name="id828940-bb"></a><span class="bold"><strong>operator</strong></span>-(<span class="bold"><strong>const</strong></span> duration_type & d) <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
125 | <li><pre class="literallayout"><span class="type">duration_type</span> <a name="id828964-bb"></a><span class="bold"><strong>operator</strong></span>+(<span class="bold"><strong>const</strong></span> duration_type & d) <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
126 | <li><pre class="literallayout"><span class="type">duration_type</span> <a name="id828987-bb"></a><span class="bold"><strong>operator</strong></span>/(<span class="bold"><strong>int</strong></span> divisor) <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
127 | <li><pre class="literallayout"><span class="type">duration_type</span> <a name="id829086-bb"></a><span class="bold"><strong>operator</strong></span>-=(<span class="bold"><strong>const</strong></span> duration_type & d) ;</pre></li> |
---|
128 | <li><pre class="literallayout"><span class="type">duration_type</span> <a name="id829110-bb"></a><span class="bold"><strong>operator</strong></span>+=(<span class="bold"><strong>const</strong></span> duration_type & d) ;</pre></li> |
---|
129 | <li><pre class="literallayout"><span class="type">duration_type</span> <a name="id837255-bb"></a><span class="bold"><strong>operator</strong></span>/=(<span class="bold"><strong>int</strong></span> divisor) ;</pre></li> |
---|
130 | <li><pre class="literallayout"><span class="type">duration_type</span> <a name="id829509-bb"></a><span class="bold"><strong>operator</strong></span> *(<span class="bold"><strong>int</strong></span> rhs) <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
131 | <li><pre class="literallayout"><span class="type">duration_type</span> <a name="id689922-bb"></a><span class="bold"><strong>operator</strong></span> *=(<span class="bold"><strong>int</strong></span> divisor) ;</pre></li> |
---|
132 | <li><pre class="literallayout"><span class="type">tick_type</span> <a name="id870539-bb"></a>ticks() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
133 | <li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id870552-bb"></a>is_special() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
134 | <li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id870569-bb"></a>is_pos_infinity() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
135 | <li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id799594-bb"></a>is_neg_infinity() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
136 | <li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id799611-bb"></a>is_not_a_date_time() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
137 | <li><pre class="literallayout"><span class="type">impl_type</span> <a name="id828518-bb"></a>get_rep() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
138 | </ol></div> |
---|
139 | </div> |
---|
140 | <div class="refsect2" lang="en"> |
---|
141 | <a name="id1136926"></a><h3> |
---|
142 | <a name="id795496-bb"></a><code class="computeroutput">time_duration</code> public static functions</h3> |
---|
143 | <div class="orderedlist"><ol type="1"> |
---|
144 | <li><pre class="literallayout"><span class="type">duration_type</span> <a name="id795501-bb"></a>unit() ;</pre></li> |
---|
145 | <li><pre class="literallayout"><span class="type">tick_type</span> <a name="id795519-bb"></a>ticks_per_second() ;</pre></li> |
---|
146 | <li><pre class="literallayout"><span class="type">time_resolutions</span> <a name="id795536-bb"></a>resolution() ;</pre></li> |
---|
147 | <li><pre class="literallayout"><span class="type"><span class="bold"><strong>unsigned</strong></span> <span class="bold"><strong>short</strong></span></span> <a name="id798672-bb"></a>num_fractional_digits() ;</pre></li> |
---|
148 | </ol></div> |
---|
149 | </div> |
---|
150 | <div class="refsect2" lang="en"> |
---|
151 | <a name="id1137022"></a><h3> |
---|
152 | <a name="id798691-bb"></a><code class="computeroutput">time_duration</code> protected member functions</h3> |
---|
153 | <div class="orderedlist"><ol type="1"></ol></div> |
---|
154 | </div> |
---|
155 | </div> |
---|
156 | </div> |
---|
157 | <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> |
---|
158 | <td align="left"></td> |
---|
159 | <td align="right"><small>Copyright © 2001-2005 CrystalClear Software, Inc</small></td> |
---|
160 | </tr></table> |
---|
161 | <hr> |
---|
162 | <div class="spirit-nav"> |
---|
163 | <a accesskey="p" href="second_clock.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="date_time/doxy.html#id863086"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="subsecond_duration.html"><img src="images/next.png" alt="Next"></a> |
---|
164 | </div> |
---|
165 | </body> |
---|
166 | </html> |
---|