1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5<title>Class template dst_calculator</title> 6<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> 7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 8<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> 9<link rel="up" href="../../date_time/doxy.html#header.boost.date_time.dst_rules_hpp" title="Header <boost/date_time/dst_rules.hpp>"> 10<link rel="prev" href="dst_calc_engine.html" title="Class template dst_calc_engine"> 11<link rel="next" href="null_dst_rules.html" title="Class template null_dst_rules"> 12</head> 13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 14<table cellpadding="2" width="100%"><tr> 15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> 16<td align="center"><a href="../../../../index.html">Home</a></td> 17<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> 18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 20<td align="center"><a href="../../../../more/index.htm">More</a></td> 21</tr></table> 22<hr> 23<div class="spirit-nav"> 24<a accesskey="p" href="dst_calc_engine.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../date_time/doxy.html#header.boost.date_time.dst_rules_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="null_dst_rules.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 25</div> 26<div class="refentry"> 27<a name="boost.date_time.dst_calculator"></a><div class="titlepage"></div> 28<div class="refnamediv"> 29<h2><span class="refentrytitle">Class template dst_calculator</span></h2> 30<p>boost::date_time::dst_calculator — Dynamic class used to caluclate dst transition information. </p> 31</div> 32<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> 33<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="../../date_time/doxy.html#header.boost.date_time.dst_rules_hpp" title="Header <boost/date_time/dst_rules.hpp>">boost/date_time/dst_rules.hpp</a>> 34 35</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> date_type_<span class="special">,</span> <span class="keyword">typename</span> time_duration_type_<span class="special">></span> 36<span class="keyword">class</span> <a class="link" href="dst_calculator.html" title="Class template dst_calculator">dst_calculator</a> <span class="special">{</span> 37<span class="keyword">public</span><span class="special">:</span> 38 <span class="comment">// types</span> 39 <span class="keyword">typedef</span> <span class="identifier">time_duration_type_</span> <a name="boost.date_time.dst_calculator.time_duration_type"></a><span class="identifier">time_duration_type</span><span class="special">;</span> 40 <span class="keyword">typedef</span> <span class="identifier">date_type_</span> <a name="boost.date_time.dst_calculator.date_type"></a><span class="identifier">date_type</span><span class="special">;</span> 41 42 <span class="comment">// <a class="link" href="dst_calculator.html#id-1_3_14_15_3_23_2_1_2_5-bb">public static functions</a></span> 43 <span class="keyword">static</span> <span class="identifier">time_is_dst_result</span> 44 <a class="link" href="dst_calculator.html#id-1_3_14_15_3_23_2_1_2_5_1-bb"><span class="identifier">process_local_dst_start_day</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">time_duration_type</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">long</span><span class="special">)</span><span class="special">;</span> 45 <span class="keyword">static</span> <span class="identifier">time_is_dst_result</span> 46 <a class="link" href="dst_calculator.html#id-1_3_14_15_3_23_2_1_2_5_2-bb"><span class="identifier">process_local_dst_end_day</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">time_duration_type</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">long</span><span class="special">)</span><span class="special">;</span> 47 <span class="keyword">static</span> <span class="identifier">time_is_dst_result</span> 48 <a class="link" href="dst_calculator.html#id-1_3_14_15_3_23_2_1_2_5_3-bb"><span class="identifier">local_is_dst</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_duration_type</span> <span class="special">&</span><span class="special">,</span> 49 <span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_duration_type</span> <span class="special">&</span><span class="special">,</span> 50 <span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_duration_type</span> <span class="special">&</span><span class="special">,</span> 51 <span class="keyword">const</span> <span class="identifier">time_duration_type</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span> 52 <span class="keyword">static</span> <span class="identifier">time_is_dst_result</span> 53 <a class="link" href="dst_calculator.html#id-1_3_14_15_3_23_2_1_2_5_4-bb"><span class="identifier">local_is_dst</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_duration_type</span> <span class="special">&</span><span class="special">,</span> 54 <span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&</span><span class="special">,</span> 55 <span class="keyword">unsigned</span> <span class="keyword">int</span><span class="special">,</span> <span class="keyword">long</span><span class="special">)</span><span class="special">;</span> 56<span class="special">}</span><span class="special">;</span></pre></div> 57<div class="refsect1"> 58<a name="id-1.3.14.15.3.23.5.4"></a><h2>Description</h2> 59<div class="refsect2"> 60<a name="id-1.3.14.15.3.23.5.4.2"></a><h3> 61<a name="id-1_3_14_15_3_23_2_1_2_5-bb"></a><code class="computeroutput">dst_calculator</code> public static functions</h3> 62<div class="orderedlist"><ol class="orderedlist" type="1"> 63<li class="listitem"> 64<pre class="literallayout"><span class="keyword">static</span> <span class="identifier">time_is_dst_result</span> 65<a name="id-1_3_14_15_3_23_2_1_2_5_1-bb"></a><span class="identifier">process_local_dst_start_day</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">time_duration_type</span> <span class="special">&</span> time_of_day<span class="special">,</span> 66 <span class="keyword">unsigned</span> <span class="keyword">int</span> dst_start_offset_minutes<span class="special">,</span> 67 <span class="keyword">long</span> dst_length_minutes<span class="special">)</span><span class="special">;</span></pre>Check the local time offset when on dst start day. <p>On this dst transition, the time label between the transition boundary and the boudary + the offset are invalid times. If before the boundary then still not in dst. 68 69</p> 70<div class="variablelist"><table border="0" class="variablelist compact"> 71<colgroup> 72<col align="left" valign="top"> 73<col> 74</colgroup> 75<tbody><tr> 76<td><p><span class="term">Parameters:</span></p></td> 77<td><div class="variablelist"><table border="0" class="variablelist compact"> 78<colgroup> 79<col align="left" valign="top"> 80<col> 81</colgroup> 82<tbody> 83<tr> 84<td><p><span class="term"><code class="computeroutput">dst_length_minutes</code></span></p></td> 85<td><p>Number of minutes to adjust clock forward </p></td> 86</tr> 87<tr> 88<td><p><span class="term"><code class="computeroutput">dst_start_offset_minutes</code></span></p></td> 89<td><p>Local day offset for start of dst </p></td> 90</tr> 91<tr> 92<td><p><span class="term"><code class="computeroutput">time_of_day</code></span></p></td> 93<td><p>Time offset in the day for the local time </p></td> 94</tr> 95</tbody> 96</table></div></td> 97</tr></tbody> 98</table></div> 99</li> 100<li class="listitem"> 101<pre class="literallayout"><span class="keyword">static</span> <span class="identifier">time_is_dst_result</span> 102<a name="id-1_3_14_15_3_23_2_1_2_5_2-bb"></a><span class="identifier">process_local_dst_end_day</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">time_duration_type</span> <span class="special">&</span> time_of_day<span class="special">,</span> 103 <span class="keyword">unsigned</span> <span class="keyword">int</span> dst_end_offset_minutes<span class="special">,</span> 104 <span class="keyword">long</span> dst_length_minutes<span class="special">)</span><span class="special">;</span></pre>Check the local time offset when on the last day of dst. <p>This is the calculation for the DST end day. On that day times prior to the conversion time - dst_length (1 am in US) are still in dst. Times between the above and the switch time are ambiguous. Times after the start_offset are not in dst. 105 106</p> 107<div class="variablelist"><table border="0" class="variablelist compact"> 108<colgroup> 109<col align="left" valign="top"> 110<col> 111</colgroup> 112<tbody><tr> 113<td><p><span class="term">Parameters:</span></p></td> 114<td><div class="variablelist"><table border="0" class="variablelist compact"> 115<colgroup> 116<col align="left" valign="top"> 117<col> 118</colgroup> 119<tbody> 120<tr> 121<td><p><span class="term"><code class="computeroutput">dst_end_offset_minutes</code></span></p></td> 122<td><p>Local time of day for end of dst </p></td> 123</tr> 124<tr> 125<td><p><span class="term"><code class="computeroutput">time_of_day</code></span></p></td> 126<td><p>Time offset in the day for the local time </p></td> 127</tr> 128</tbody> 129</table></div></td> 130</tr></tbody> 131</table></div> 132</li> 133<li class="listitem"> 134<pre class="literallayout"><span class="keyword">static</span> <span class="identifier">time_is_dst_result</span> 135<a name="id-1_3_14_15_3_23_2_1_2_5_3-bb"></a><span class="identifier">local_is_dst</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&</span> current_day<span class="special">,</span> 136 <span class="keyword">const</span> <span class="identifier">time_duration_type</span> <span class="special">&</span> time_of_day<span class="special">,</span> 137 <span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&</span> dst_start_day<span class="special">,</span> 138 <span class="keyword">const</span> <span class="identifier">time_duration_type</span> <span class="special">&</span> dst_start_offset<span class="special">,</span> 139 <span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&</span> dst_end_day<span class="special">,</span> 140 <span class="keyword">const</span> <span class="identifier">time_duration_type</span> <span class="special">&</span> dst_end_offset<span class="special">,</span> 141 <span class="keyword">const</span> <span class="identifier">time_duration_type</span> <span class="special">&</span> dst_length<span class="special">)</span><span class="special">;</span></pre>Calculates if the given local time is dst or not. <p>Determines if the time is really in DST or not. Also checks for invalid and ambiguous. 142 143</p> 144<div class="variablelist"><table border="0" class="variablelist compact"> 145<colgroup> 146<col align="left" valign="top"> 147<col> 148</colgroup> 149<tbody><tr> 150<td><p><span class="term">Parameters:</span></p></td> 151<td><div class="variablelist"><table border="0" class="variablelist compact"> 152<colgroup> 153<col align="left" valign="top"> 154<col> 155</colgroup> 156<tbody> 157<tr> 158<td><p><span class="term"><code class="computeroutput">current_day</code></span></p></td> 159<td><p>The day to check for dst </p></td> 160</tr> 161<tr> 162<td><p><span class="term"><code class="computeroutput">dst_end_day</code></span></p></td> 163<td><p>Ending day of dst for the given locality </p></td> 164</tr> 165<tr> 166<td><p><span class="term"><code class="computeroutput">dst_end_offset</code></span></p></td> 167<td><p>Time offset within day given in dst for dst boundary </p></td> 168</tr> 169<tr> 170<td><p><span class="term"><code class="computeroutput">dst_start_day</code></span></p></td> 171<td><p>Starting day of dst for the given locality </p></td> 172</tr> 173<tr> 174<td><p><span class="term"><code class="computeroutput">dst_start_offset</code></span></p></td> 175<td><p>Time offset within day for dst boundary </p></td> 176</tr> 177<tr> 178<td><p><span class="term"><code class="computeroutput">time_of_day</code></span></p></td> 179<td><p>Time offset within the day to check </p></td> 180</tr> 181</tbody> 182</table></div></td> 183</tr></tbody> 184</table></div> 185</li> 186<li class="listitem"> 187<pre class="literallayout"><span class="keyword">static</span> <span class="identifier">time_is_dst_result</span> 188<a name="id-1_3_14_15_3_23_2_1_2_5_4-bb"></a><span class="identifier">local_is_dst</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&</span> current_day<span class="special">,</span> 189 <span class="keyword">const</span> <span class="identifier">time_duration_type</span> <span class="special">&</span> time_of_day<span class="special">,</span> 190 <span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&</span> dst_start_day<span class="special">,</span> 191 <span class="keyword">unsigned</span> <span class="keyword">int</span> dst_start_offset_minutes<span class="special">,</span> 192 <span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&</span> dst_end_day<span class="special">,</span> 193 <span class="keyword">unsigned</span> <span class="keyword">int</span> dst_end_offset_minutes<span class="special">,</span> <span class="keyword">long</span> dst_length_minutes<span class="special">)</span><span class="special">;</span></pre>Calculates if the given local time is dst or not. <p>Determines if the time is really in DST or not. Also checks for invalid and ambiguous. 194 195</p> 196<div class="variablelist"><table border="0" class="variablelist compact"> 197<colgroup> 198<col align="left" valign="top"> 199<col> 200</colgroup> 201<tbody><tr> 202<td><p><span class="term">Parameters:</span></p></td> 203<td><div class="variablelist"><table border="0" class="variablelist compact"> 204<colgroup> 205<col align="left" valign="top"> 206<col> 207</colgroup> 208<tbody> 209<tr> 210<td><p><span class="term"><code class="computeroutput">current_day</code></span></p></td> 211<td><p>The day to check for dst </p></td> 212</tr> 213<tr> 214<td><p><span class="term"><code class="computeroutput">dst_end_day</code></span></p></td> 215<td><p>Ending day of dst for the given locality </p></td> 216</tr> 217<tr> 218<td><p><span class="term"><code class="computeroutput">dst_end_offset_minutes</code></span></p></td> 219<td><p>Offset within day given in dst for dst boundary (eg 120 for US which is 02:00:00) </p></td> 220</tr> 221<tr> 222<td><p><span class="term"><code class="computeroutput">dst_length_minutes</code></span></p></td> 223<td><p>Length of dst adjusment (eg: 60 for US) </p></td> 224</tr> 225<tr> 226<td><p><span class="term"><code class="computeroutput">dst_start_day</code></span></p></td> 227<td><p>Starting day of dst for the given locality </p></td> 228</tr> 229<tr> 230<td><p><span class="term"><code class="computeroutput">dst_start_offset_minutes</code></span></p></td> 231<td><p>Offset within day for dst boundary (eg 120 for US which is 02:00:00) </p></td> 232</tr> 233<tr> 234<td><p><span class="term"><code class="computeroutput">time_of_day</code></span></p></td> 235<td><p>Time offset within the day to check </p></td> 236</tr> 237</tbody> 238</table></div></td> 239</tr></tbody> 240</table></div> 241</li> 242</ol></div> 243</div> 244</div> 245</div> 246<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 247<td align="left"></td> 248<td align="right"><div class="copyright-footer">Copyright © 2001-2005 CrystalClear Software, Inc<p>Subject to the Boost Software License, Version 1.0. (See accompanying file 249 <code class="filename">LICENSE_1_0.txt</code> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</p> 250</div></td> 251</tr></table> 252<hr> 253<div class="spirit-nav"> 254<a accesskey="p" href="dst_calc_engine.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../date_time/doxy.html#header.boost.date_time.dst_rules_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="null_dst_rules.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 255</div> 256</body> 257</html> 258