1 | <html> |
---|
2 | <head> |
---|
3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
---|
4 | <title>Struct template us_dst_trait</title> |
---|
5 | <link rel="stylesheet" href="boostbook.css" type="text/css"> |
---|
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.69.1"> |
---|
7 | <link rel="start" href="index.html" title="The Boost C++ Libraries"> |
---|
8 | <link rel="up" href="date_time/doxy.html#id2503510" title="Header <boost/date_time/local_timezone_defs.hpp>"> |
---|
9 | <link rel="prev" href="local_adjustor.html" title="Class template local_adjustor"> |
---|
10 | <link rel="next" href="eu_dst_trait.html" title="Struct template eu_dst_trait"> |
---|
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="local_adjustor.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="date_time/doxy.html#id2503510"><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="eu_dst_trait.html"><img src="images/next.png" alt="Next"></a> |
---|
24 | </div> |
---|
25 | <div class="refentry" lang="en"> |
---|
26 | <a name="us_dst_trait"></a><div class="titlepage"></div> |
---|
27 | <div class="refnamediv"> |
---|
28 | <h2><span class="refentrytitle">Struct template us_dst_trait</span></h2> |
---|
29 | <p>boost::date_time::us_dst_trait — Specification for daylight savings start rules in US. </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> date_type> |
---|
33 | <span class="bold"><strong>struct</strong></span> us_dst_trait { |
---|
34 | <span class="emphasis"><em>// types</em></span> |
---|
35 | <span class="bold"><strong>typedef</strong></span> date_type::day_of_week_type day_of_week_type; |
---|
36 | <span class="bold"><strong>typedef</strong></span> date_type::month_type month_type; |
---|
37 | <span class="bold"><strong>typedef</strong></span> <a href="first_kday_of_month.html" title="Class template first_kday_of_month">date_time::first_kday_of_month</a>< date_type > start_rule_functor; |
---|
38 | <span class="bold"><strong>typedef</strong></span> <a href="last_kday_of_month.html" title="Class template last_kday_of_month">date_time::last_kday_of_month</a>< date_type > end_rule_functor; |
---|
39 | |
---|
40 | <span class="emphasis"><em>// <a href="us_dst_trait.html#id2423374-bb">public static functions</a></em></span> |
---|
41 | <span class="type">day_of_week_type</span> <a href="us_dst_trait.html#id2423379-bb">start_day</a>() ; |
---|
42 | <span class="type">month_type</span> <a href="us_dst_trait.html#id2414361-bb">start_month</a>() ; |
---|
43 | <span class="type">day_of_week_type</span> <a href="us_dst_trait.html#id2414373-bb">end_day</a>() ; |
---|
44 | <span class="type">month_type</span> <a href="us_dst_trait.html#id2512623-bb">end_month</a>() ; |
---|
45 | <span class="type"><span class="bold"><strong>int</strong></span></span> <a href="us_dst_trait.html#id2512636-bb">dst_start_offset_minutes</a>() ; |
---|
46 | <span class="type"><span class="bold"><strong>int</strong></span></span> <a href="us_dst_trait.html#id2471210-bb">dst_end_offset_minutes</a>() ; |
---|
47 | <span class="type"><span class="bold"><strong>int</strong></span></span> <a href="us_dst_trait.html#id2471222-bb">dst_shift_length_minutes</a>() ; |
---|
48 | };</pre></div> |
---|
49 | <div class="refsect1" lang="en"> |
---|
50 | <a name="id2644086"></a><h2>Description</h2> |
---|
51 | <p>This class is used to configure dst_calc_engine template typically as follows: </p> |
---|
52 | <pre class="programlisting"> using namespace boost::gregorian; |
---|
53 | using namespace boost::posix_time; |
---|
54 | typedef us_dst_trait<date> us_dst_traits; |
---|
55 | typedef boost::date_time::dst_calc_engine<date, time_duration, |
---|
56 | us_dst_traits> |
---|
57 | us_dst_calc; |
---|
58 | //calculate the 2002 transition day of USA April 7 2002 |
---|
59 | date dst_start = us_dst_calc::local_dst_start_day(2002); |
---|
60 | |
---|
61 | //calculate the 2002 transition day of USA Oct 27 2002 |
---|
62 | date dst_end = us_dst_calc::local_dst_end_day(2002); |
---|
63 | |
---|
64 | //check if a local time is in dst or not -- posible answers |
---|
65 | //are yes, no, invalid time label, ambiguous |
---|
66 | ptime t(...some time...); |
---|
67 | if (us_dst::local_is_dst(t.date(), t.time_of_day()) |
---|
68 | == boost::date_time::is_not_in_dst) |
---|
69 | { |
---|
70 | |
---|
71 | } |
---|
72 | </pre> |
---|
73 | <p>This generates a type suitable for the calculation of dst transitions for the United States. Of course other templates can be used for other locales. </p> |
---|
74 | <div class="refsect2" lang="en"> |
---|
75 | <a name="id2644142"></a><h3> |
---|
76 | <a name="id2423374-bb"></a><code class="computeroutput">us_dst_trait</code> public static functions</h3> |
---|
77 | <div class="orderedlist"><ol type="1"> |
---|
78 | <li><pre class="literallayout"><span class="type">day_of_week_type</span> <a name="id2423379-bb"></a>start_day() ;</pre></li> |
---|
79 | <li><pre class="literallayout"><span class="type">month_type</span> <a name="id2414361-bb"></a>start_month() ;</pre></li> |
---|
80 | <li><pre class="literallayout"><span class="type">day_of_week_type</span> <a name="id2414373-bb"></a>end_day() ;</pre></li> |
---|
81 | <li><pre class="literallayout"><span class="type">month_type</span> <a name="id2512623-bb"></a>end_month() ;</pre></li> |
---|
82 | <li><pre class="literallayout"><span class="type"><span class="bold"><strong>int</strong></span></span> <a name="id2512636-bb"></a>dst_start_offset_minutes() ;</pre></li> |
---|
83 | <li><pre class="literallayout"><span class="type"><span class="bold"><strong>int</strong></span></span> <a name="id2471210-bb"></a>dst_end_offset_minutes() ;</pre></li> |
---|
84 | <li><pre class="literallayout"><span class="type"><span class="bold"><strong>int</strong></span></span> <a name="id2471222-bb"></a>dst_shift_length_minutes() ;</pre></li> |
---|
85 | </ol></div> |
---|
86 | </div> |
---|
87 | </div> |
---|
88 | </div> |
---|
89 | <table width="100%"><tr> |
---|
90 | <td align="left"></td> |
---|
91 | <td align="right"><small>Copyright © 2001-2005 CrystalClear Software, Inc</small></td> |
---|
92 | </tr></table> |
---|
93 | <hr> |
---|
94 | <div class="spirit-nav"> |
---|
95 | <a accesskey="p" href="local_adjustor.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="date_time/doxy.html#id2503510"><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="eu_dst_trait.html"><img src="images/next.png" alt="Next"></a> |
---|
96 | </div> |
---|
97 | </body> |
---|
98 | </html> |
---|