Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/doc/html/id786780.html @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 18.9 KB
RevLine 
[12]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.67.2">
7<link rel="start" href="index.html" title="The Boost C++ Libraries">
8<link rel="up" href="date_time/doxy.html#id786765" title="Header &lt;boost/date_time/time_duration.hpp&gt;">
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#id786765"><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="id786780"></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 &#8212; 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>&lt;<span class="bold"><strong>typename</strong></span> T, <span class="bold"><strong>typename</strong></span> rep_type&gt; 
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="id786780.html#id786780construct-copy-destruct">construct/copy/destruct</a></em></span>
47  <a href="id786780.html#id763895-bb">time_duration</a>();
48  <a href="id786780.html#id763898-bb">time_duration</a>(hour_type, min_type, sec_type = 0,
49                fractional_seconds_type = 0);
50  <a href="id786780.html#id798154-bb">time_duration</a>(<span class="bold"><strong>const</strong></span> <a href="id786780.html" title="Class template time_duration">time_duration</a>&lt; T, rep_type &gt; &amp;);
51  <a href="id786780.html#id798176-bb">time_duration</a>(special_values);
52  <a href="id786780.html#id792633-bb">time_duration</a>(impl_type);
53
54  <span class="emphasis"><em>// <a href="id786780.html#id786907-bb">public member functions</a></em></span>
55  <span class="type">hour_type</span> <a href="id786780.html#id786912-bb">hours</a>() <span class="bold"><strong>const</strong></span>;
56  <span class="type">min_type</span> <a href="id786780.html#id786928-bb">minutes</a>() <span class="bold"><strong>const</strong></span>;
57  <span class="type">sec_type</span> <a href="id786780.html#id786944-bb">seconds</a>() <span class="bold"><strong>const</strong></span>;
58  <span class="type">sec_type</span> <a href="id786780.html#id786960-bb">total_seconds</a>() <span class="bold"><strong>const</strong></span>;
59  <span class="type">tick_type</span> <a href="id786780.html#id786976-bb">total_milliseconds</a>() <span class="bold"><strong>const</strong></span>;
60  <span class="type">tick_type</span> <a href="id786780.html#id800060-bb">total_nanoseconds</a>() <span class="bold"><strong>const</strong></span>;
61  <span class="type">tick_type</span> <a href="id786780.html#id800077-bb">total_microseconds</a>() <span class="bold"><strong>const</strong></span>;
62  <span class="type">fractional_seconds_type</span> <a href="id786780.html#id800093-bb">fractional_seconds</a>() <span class="bold"><strong>const</strong></span>;
63  <span class="type">duration_type</span> <a href="id786780.html#id729889-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="id786780.html#id729901-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="id786780.html#id729913-bb"><span class="bold"><strong>operator</strong></span>&lt;</a>(<span class="bold"><strong>const</strong></span> <a href="id786780.html" title="Class template time_duration">time_duration</a> &amp;) <span class="bold"><strong>const</strong></span>;
66  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="id786780.html#id1043119-bb"><span class="bold"><strong>operator</strong></span>==</a>(<span class="bold"><strong>const</strong></span> <a href="id786780.html" title="Class template time_duration">time_duration</a> &amp;) <span class="bold"><strong>const</strong></span>;
67  <span class="type">duration_type</span> <a href="id786780.html#id1043144-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="id786780.html#id1043160-bb"><span class="bold"><strong>operator</strong></span>-</a>(<span class="bold"><strong>const</strong></span> duration_type &amp;) <span class="bold"><strong>const</strong></span>;
69  <span class="type">duration_type</span> <a href="id786780.html#id1043182-bb"><span class="bold"><strong>operator</strong></span>+</a>(<span class="bold"><strong>const</strong></span> duration_type &amp;) <span class="bold"><strong>const</strong></span>;
70  <span class="type">duration_type</span> <a href="id786780.html#id1043204-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="id786780.html#id1043226-bb"><span class="bold"><strong>operator</strong></span>-=</a>(<span class="bold"><strong>const</strong></span> duration_type &amp;) ;
72  <span class="type">duration_type</span> <a href="id786780.html#id755958-bb"><span class="bold"><strong>operator</strong></span>+=</a>(<span class="bold"><strong>const</strong></span> duration_type &amp;) ;
73  <span class="type">duration_type</span> <a href="id786780.html#id822323-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="id786780.html#id754592-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="id786780.html#id685338-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="id786780.html#id685359-bb">ticks</a>() <span class="bold"><strong>const</strong></span>;
77  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="id786780.html#id685370-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="id786780.html#id763830-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="id786780.html#id763846-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="id786780.html#id763862-bb">is_not_a_date_time</a>() <span class="bold"><strong>const</strong></span>;
81  <span class="type">impl_type</span> <a href="id786780.html#id763878-bb">get_rep</a>() <span class="bold"><strong>const</strong></span>;
82
83  <span class="emphasis"><em>// <a href="id786780.html#id798193-bb">public static functions</a></em></span>
84  <span class="type">duration_type</span> <a href="id786780.html#id794382-bb">unit</a>() ;
85  <span class="type">tick_type</span> <a href="id786780.html#id768921-bb">ticks_per_second</a>() ;
86  <span class="type">time_resolutions</span> <a href="id786780.html#id768937-bb">resolution</a>() ;
87  <span class="type"><span class="bold"><strong>unsigned</strong></span> <span class="bold"><strong>short</strong></span></span> <a href="id786780.html#id768953-bb">num_fractional_digits</a>() ;
88
89  <span class="emphasis"><em>// <a href="id786780.html#id792628-bb">protected member functions</a></em></span>
90};</pre></div>
91<div class="refsect1" lang="en">
92<a name="id1046965"></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="id1046977"></a><h3>
97<a name="id786780construct-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="id763895-bb"></a>time_duration();</pre></li>
100<li><pre class="literallayout"><a name="id763898-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="id798154-bb"></a>time_duration(<span class="bold"><strong>const</strong></span> <a href="id786780.html" title="Class template time_duration">time_duration</a>&lt; T, rep_type &gt; &amp; other);</pre></li>
103<li><pre class="literallayout"><a name="id798176-bb"></a>time_duration(special_values sv);</pre></li>
104<li><pre class="literallayout"><a name="id792633-bb"></a>time_duration(impl_type in);</pre></li>
105</ol></div>
106</div>
107<div class="refsect2" lang="en">
108<a name="id1047080"></a><h3>
109<a name="id786907-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="id786912-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="id786928-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="id786944-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="id786960-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="id786976-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="id800060-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="id800077-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="id800093-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="id729889-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="id729901-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="id729913-bb"></a><span class="bold"><strong>operator</strong></span>&lt;(<span class="bold"><strong>const</strong></span> <a href="id786780.html" title="Class template time_duration">time_duration</a> &amp; 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="id1043119-bb"></a><span class="bold"><strong>operator</strong></span>==(<span class="bold"><strong>const</strong></span> <a href="id786780.html" title="Class template time_duration">time_duration</a> &amp; rhs) <span class="bold"><strong>const</strong></span>;</pre></li>
123<li><pre class="literallayout"><span class="type">duration_type</span> <a name="id1043144-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="id1043160-bb"></a><span class="bold"><strong>operator</strong></span>-(<span class="bold"><strong>const</strong></span> duration_type &amp; d) <span class="bold"><strong>const</strong></span>;</pre></li>
125<li><pre class="literallayout"><span class="type">duration_type</span> <a name="id1043182-bb"></a><span class="bold"><strong>operator</strong></span>+(<span class="bold"><strong>const</strong></span> duration_type &amp; d) <span class="bold"><strong>const</strong></span>;</pre></li>
126<li><pre class="literallayout"><span class="type">duration_type</span> <a name="id1043204-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="id1043226-bb"></a><span class="bold"><strong>operator</strong></span>-=(<span class="bold"><strong>const</strong></span> duration_type &amp; d) ;</pre></li>
128<li><pre class="literallayout"><span class="type">duration_type</span> <a name="id755958-bb"></a><span class="bold"><strong>operator</strong></span>+=(<span class="bold"><strong>const</strong></span> duration_type &amp; d) ;</pre></li>
129<li><pre class="literallayout"><span class="type">duration_type</span> <a name="id822323-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="id754592-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="id685338-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="id685359-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="id685370-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="id763830-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="id763846-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="id763862-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="id763878-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="id1047826"></a><h3>
142<a name="id798193-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="id794382-bb"></a>unit() ;</pre></li>
145<li><pre class="literallayout"><span class="type">tick_type</span> <a name="id768921-bb"></a>ticks_per_second() ;</pre></li>
146<li><pre class="literallayout"><span class="type">time_resolutions</span> <a name="id768937-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="id768953-bb"></a>num_fractional_digits() ;</pre></li>
148</ol></div>
149</div>
150<div class="refsect2" lang="en">
151<a name="id1047921"></a><h3>
152<a name="id792628-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#id786765"><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>
Note: See TracBrowser for help on using the repository browser.