Imported Upstream version 1.57.0
[platform/upstream/boost.git] / doc / html / date_time / details.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Details</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="The Boost C++ Libraries BoostBook Documentation Subset">
8 <link rel="up" href="../date_time.html" title="Chapter&#160;9.&#160;Boost.Date_Time">
9 <link rel="prev" href="serialization.html" title="Serialization">
10 <link rel="next" href="examples.html" title="Examples">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
15 <td align="center"><a href="../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="serialization.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../date_time.html"><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="examples.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
27 <a name="date_time.details"></a>Details</h2></div></div></div>
28 <div class="toc"><dl class="toc">
29 <dt><span class="section"><a href="details.html#date_time.calculations">Calculations</a></span></dt>
30 <dt><span class="section"><a href="details.html#date_time.design_goals">Design Goals</a></span></dt>
31 <dt><span class="section"><a href="details.html#date_time.tradeoffs">Tradeoffs: Stability, Predictability, and Approximations</a></span></dt>
32 <dt><span class="section"><a href="details.html#date_time.terminology">Terminology</a></span></dt>
33 <dt><span class="section"><a href="details.html#date_time.references">References</a></span></dt>
34 <dt><span class="section"><a href="details.html#date_time.buildinfo">Build-Compiler Information</a></span></dt>
35 <dt><span class="section"><a href="details.html#date_time.tests">Tests</a></span></dt>
36 <dt><span class="section"><a href="details.html#date_time.changes">Change History</a></span></dt>
37 <dt><span class="section"><a href="details.html#date_time.acknowledgements">Acknowledgements</a></span></dt>
38 </dl></div>
39 <div class="section">
40 <div class="titlepage"><div><div><h3 class="title">
41 <a name="date_time.calculations"></a>Calculations</h3></div></div></div>
42 <p>
43     <a class="link" href="details.html#timepoints">Timepoints</a> -- 
44     <a class="link" href="details.html#durations">Durations</a> -- 
45     <a class="link" href="details.html#intervals">Intervals (Periods)</a> -- 
46     <a class="link" href="details.html#special_value_handling">Special Value Handling</a>
47   </p>
48 <a name="timepoints"></a><h4>
49 <a name="idp180906720"></a>Timepoints</h4>
50 <p>
51     This section describes some of basic arithmetic rules that can be performed with timepoints. In general, Timepoints support basic arithmetic in conjunction with Durations as follows:
52     </p>
53 <pre class="programlisting">
54       Timepoint + Duration  --&gt; Timepoint
55       Timepoint - Duration  --&gt; Timepoint
56       Timepoint - Timepoint --&gt; Duration
57     </pre>
58 <p>
59     Unlike regular numeric types, the following operations are undefined:
60     </p>
61 <pre class="programlisting">
62       Duration + Timepoint  --&gt; Undefined
63       Duration - Timepoint  --&gt; Undefined
64       Timepoint + Timepoint --&gt; Undefined
65     </pre>
66 <p>
67   </p>
68 <a name="durations"></a><h4>
69 <a name="idp180910544"></a>Durations</h4>
70 <p>
71     Durations represent a length of time and can have positive and negative values. It is frequently useful to be able to perform calculations with other durations and with simple integral values. The following describes these calculations:
72     </p>
73 <pre class="programlisting">
74       Duration + Duration  --&gt; Duration
75       Duration - Duration  --&gt; Duration
76       
77       Duration * Integer   --&gt; Duration
78       Integer  * Duration  --&gt; Duration
79       Duration / Integer   --&gt; Duration  (Integer Division rules)
80     </pre>
81 <p>
82   </p>
83 <a name="intervals"></a><h4>
84 <a name="idp180913728"></a>Intervals (Periods)</h4>
85 <p>
86     Interval logic is extremely useful for simplifying many 'calculations' for dates and times. The following describes the operations provided by periods which are based on half-open range. The following operations calculate new time periods based on two input time periods: 
87     </p>
88 <pre class="programlisting">
89 Timeperiod intersection Timeperiod --&gt; Timeperiod 
90   (null interval if no intersection)
91 Timeperiod merge Timeperiod        --&gt; Timeperiod 
92   (null interval if no intersection)
93 Timeperiod shift Duration          --&gt; Timeperiod 
94   (shift start and end by duration amount)
95     </pre>
96 <p>
97     In addition, periods support various queries that calculate boolean results. The first set is caluculations with other time periods:
98     </p>
99 <pre class="programlisting">
100   Timeperiod == Timeperiod           --&gt; bool
101   Timeperiod &lt; Timeperiod            --&gt; bool (true if lhs.last &lt;= rhs.begin)
102   Timeperiod intersects Timeperiod   --&gt; bool
103   Timeperiod contains Timeperiod     --&gt; bool
104   Timeperiod is_adjacent Timeperiod  --&gt; bool 
105     </pre>
106 <p>
107     The following calculations are performed versus the Timepoint.
108     </p>
109 <pre class="programlisting">
110   Timeperiod contains Timepoint      --&gt; bool
111   Timeperiod is_before Timepoint     --&gt; bool
112   Timeperiod is_after Timepoint      --&gt; bool 
113     </pre>
114 <p>
115   </p>
116 <a name="special_value_handling"></a><h4>
117 <a name="idp180919184"></a>Special Value Handling</h4>
118 <p>
119     For many temporal problems it is useful for Duration and Timepoint types to support special values such as Not A Date Time (NADT) and infinity. In general special values such as Not A Date Time (NADT) and infinity should follow rules like floating point values. Note that it should be possible to configure NADT based systems to throw an exception instead of result in NADT. 
120     </p>
121 <pre class="programlisting">
122   Timepoint(NADT) + Duration --&gt; Timepoint(NADT)
123   Timepoint(&#8734;) + Duration    --&gt; Timepoint(&#8734;)
124   Timepoint + Duration(&#8734;)    --&gt; Timepoint(&#8734;)
125   Timepoint - Duration(&#8734;)    --&gt; Timepoint(-&#8734;)
126     </pre>
127 <p>
128     When performing operations on both positive and negative infinities, the library will produce results consistent with the following. 
129     </p>
130 <pre class="programlisting">
131   Timepoint(+&#8734;) + Duration(-&#8734;) --&gt; NADT
132   Duration(+&#8734;) + Duration(-&#8734;)  --&gt; NADT
133   Duration(&#177;&#8734;) * Zero          --&gt; NADT
134   
135   Duration(&#8734;) * Integer(Not Zero) --&gt; Duration(&#8734;)
136   Duration(+&#8734;) * -Integer         --&gt; Duration(-&#8734;)
137   Duration(&#8734;) / Integer           --&gt; Duration(&#8734;)
138     </pre>
139 <p>
140   </p>
141 </div>
142 <div class="section">
143 <div class="titlepage"><div><div><h3 class="title">
144 <a name="date_time.design_goals"></a>Design Goals</h3></div></div></div>
145 <div class="informaltable"><table class="table">
146 <colgroup>
147 <col>
148 <col>
149 </colgroup>
150 <thead>
151 <tr>
152 <th rowspan="2" valign="top">Category</th>
153 <th>Description</th>
154 </tr>
155 <tr><th>Functions</th></tr>
156 </thead>
157 <tbody>
158 <tr>
159 <td rowspan="2" valign="top">Interfaces</td>
160 <td>Provide concrete classes for manipulation of dates and times</td>
161 </tr>
162 <tr><td> 
163             <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
164 <li class="listitem" style="list-style-type: disc">date, time, date_duration, time_duration, date_period, time_period, etc</li>
165 <li class="listitem" style="list-style-type: disc">support for infinity - positive infinity, negative infinity</li>
166 <li class="listitem" style="list-style-type: disc">iterators over time and date ranges</li>
167 <li class="listitem" style="list-style-type: disc">allow date and time implementations to be separate as much as possible</li>
168 </ul></div>
169           </td></tr>
170 <tr>
171 <td rowspan="2" valign="top">Calculation</td>
172 <td>Provide a basis for performing efficient time calculations </td>
173 </tr>
174 <tr><td> 
175             <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
176 <li class="listitem" style="list-style-type: disc">days between dates </li>
177 <li class="listitem" style="list-style-type: disc">durations of times </li>
178 <li class="listitem" style="list-style-type: disc">durations of dates and times together </li>
179 </ul></div>
180           </td></tr>
181 <tr>
182 <td rowspan="2" valign="top">Representation Flexibility</td>
183 <td>Provide the maximum possible reusability and flexibility</td>
184 </tr>
185 <tr><td>
186             <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
187 <li class="listitem" style="list-style-type: disc">traits based customization of internal representations for size versus resolution control</li>
188 <li class="listitem" style="list-style-type: disc">Allowing the use of different epochs and resolution (eg: seconds versus microseconds, dates starting at the year 2000 versus dates starting in 1700)</li>
189 <li class="listitem" style="list-style-type: disc">Options for configuring unique calendar representations (Gregorian + others)</li>
190 <li class="listitem" style="list-style-type: disc">the use of Julian Day number and the conversion between this and the Gregorian/Julian calendar date</li>
191 <li class="listitem" style="list-style-type: disc">Allow for flexible adjustments including leap seconds</li>
192 </ul></div>
193           </td></tr>
194 <tr>
195 <td rowspan="2" valign="top">Date Calculations</td>
196 <td>Provide tools for date calculations</td>
197 </tr>
198 <tr><td> 
199             <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
200 <li class="listitem" style="list-style-type: disc">provide basis for calculation of complex event specs like holidays</li>
201 <li class="listitem" style="list-style-type: disc">calendar to calendar conversions</li>
202 <li class="listitem" style="list-style-type: disc">provide for ability to extend to new calendar systems</li>
203 </ul></div> 
204           </td></tr>
205 <tr>
206 <td rowspan="2" valign="top">Time Calculations</td>
207 <td>Provide concrete classes for manipulation of time</td>
208 </tr>
209 <tr><td> 
210             <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
211 <li class="listitem" style="list-style-type: disc">provide the ability to handle cross time-zone issues</li>
212 <li class="listitem" style="list-style-type: disc">provide adjustments for daylight savings time (summer time)</li>
213 </ul></div> 
214           </td></tr>
215 <tr>
216 <td rowspan="2" valign="top">Clock Interfaces</td>
217 <td>Provide classes for retrieving time current time</td>
218 </tr>
219 <tr><td> 
220             <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
221 <li class="listitem" style="list-style-type: disc">access to a network / high resolution time sources </li>
222 <li class="listitem" style="list-style-type: disc">retrieving the current date time information to populate classes </li>
223 </ul></div> 
224           </td></tr>
225 <tr>
226 <td rowspan="2" valign="top">I/O Interfaces</td>
227 <td>Provide input and output for time including</td>
228 </tr>
229 <tr><td> 
230             <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
231 <li class="listitem" style="list-style-type: disc">multi-lingual support </li>
232 <li class="listitem" style="list-style-type: disc">provide ISO8601 compliant time facet </li>
233 <li class="listitem" style="list-style-type: disc">use I/O facets for different local behavior </li>
234 </ul></div> 
235           </td></tr>
236 </tbody>
237 </table></div>
238 </div>
239 <div class="section">
240 <div class="titlepage"><div><div><h3 class="title">
241 <a name="date_time.tradeoffs"></a>Tradeoffs: Stability, Predictability, and Approximations</h3></div></div></div>
242 <h3>
243 <a name="idp180962528"></a>
244     Unavoidable Trade-offs
245   </h3>
246 <p>
247     The library does its best to provide everything a user could want, but there are certain inherent constraints that limit what <span class="emphasis"><em>any</em></span> temporal library can do. Specifically, a user must choose which two of the following three capabilities are desired in any particular application:
248     </p>
249 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
250 <li class="listitem" style="list-style-type: disc">exact agreement with wall-clock time</li>
251 <li class="listitem" style="list-style-type: disc">accurate math, e.g. duration calculations</li>
252 <li class="listitem" style="list-style-type: disc">ability to handle timepoints in the future</li>
253 </ul></div>
254 <p>
255     Some libraries may implicitly promise to deliver all three, but if you actually put them to the test, only two can be true at once. This limitation is not a deficiency in the design or implementation of any particular library; rather it is a consequence of the way different time systems are defined by international standards. Let's look at each of the three cases:
256   </p>
257 <p>
258     If you want exact agreement with wall-clock time, you must use either UTC or local time. If you compute a duration by subtracting one UTC time from another and you want an answer accurate to the second, the two times must not be too far in the future because leap seconds affect the count but are only determined about 6 months in advance. With local times a future duration calculation could be off by an entire hour, since legislatures can and do change DST rules at will. 
259   </p>
260 <p>
261     If you want to handle wall-clock times in the future, you won't be able (in the general case) to calculate exact durations, for the same reasons described above. 
262   </p>
263 <p>
264     If you want accurate calculations with future times, you will have to use TAI or an equivalent, but the mapping from TAI to UTC or local time depends on leap seconds, so you will not have exact agreement with wall-clock time. 
265   </p>
266 <h3>
267 <a name="idp180968752"></a>
268     Stability, Predictability, and Approximations
269   </h3>
270 <p>
271     Here is some underlying theory that helps to explain what's going on. Remember that a temporal type, like any abstract data type (ADT), is a set of values together with operations on those values. 
272   </p>
273 <h4>
274 <a name="idp180970080"></a>
275     Stability
276   </h4>
277 <p>
278     The representation of a type is <span class="emphasis"><em>stable</em></span> if the bit pattern associated with a given value does not change over time. A type with an unstable representation is unlikely to be of much use to anyone, so we will insist that any temporal library use only stable representations. 
279   </p>
280 <p>
281     An operation on a type is stable if the result of applying the operation to a particular operand(s) does not change over time. 
282   </p>
283 <h4>
284 <a name="idp180972400"></a>
285     Predictability
286   </h4>
287 <p>
288     Sets are most often classified into two categories: well-defined and ill-defined. Since a type is a set, we can extend these definitions to cover types. For any type T, there must be a predicate <span class="emphasis"><em>is_member( x )</em></span> which determines whether a value x is a member of type T. This predicate must return <span class="emphasis"><em>true, false,</em></span> or <span class="emphasis"><em>dont_know</em></span>. 
289   </p>
290 <p>
291     If for all x, is_member( x ) returns either true or false, we say the set T is <span class="emphasis"><em>well-defined</em></span>. 
292   </p>
293 <p>
294     If for any x, is_member( x ) returns dont_know, we say the set T is <span class="emphasis"><em>ill-defined</em></span>. 
295   </p>
296 <p>
297     Those are the rules normally used in math. However, because of the special characteristics of temporal types, it is useful to refine this view and create a third category as follows: 
298   </p>
299 <p>
300     For any temporal type T, there must be a predicate <span class="emphasis"><em>is_member( x, t )</em></span> which determines whether a value x is a member of T. The parameter t represents the time when the predicate is evaluated. For each x<sub>i</sub>, there must be a time t<sub>i</sub> and a value v such that: 
301     </p>
302 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
303 <li class="listitem" style="list-style-type: disc">v = true or v = false, and</li>
304 <li class="listitem" style="list-style-type: disc">for all t &lt; t<sub>i</sub>, is_member( x<sub>i</sub>, t ) returns dont_know, and</li>
305 <li class="listitem" style="list-style-type: disc">for all t &gt;= t<sub>i</sub>, is_member( x<sub>i</sub>, t ) returns v.</li>
306 </ul></div>
307 <p>
308     t<sub>i</sub> is thus the time when we "find out" whether x<sub>i</sub> is a member of T. Now we can define three categories of temporal types:
309   </p>
310 <p>
311     If for all x<sub>i</sub>, t<sub>i</sub> = negative infinity, we say the type T is <span class="emphasis"><em>predictable</em></span>. 
312   </p>
313 <p>
314     If for some x<sub>i</sub>, t<sub>i</sub> = positive infinity, we say the type T is <span class="emphasis"><em>ill-formed</em></span>. 
315   </p>
316 <p>
317     Otherwise we say the type T is <span class="emphasis"><em>unpredictable</em></span> (this implies that for some x<sub>i</sub>, t<sub>i</sub> is finite). 
318   </p>
319 <p>
320     Ill-formed sets are not of much practical use, so we will not discuss them further. In plain english the above simply says that all the values of a predictable type are known ahead of time, but some values of an unpredictable type are not known until some particular time. 
321   </p>
322 <h4>
323 <a name="idp180989824"></a>
324     Stability of Operations
325   </h4>
326 <p>
327     Predictable types have a couple of important properties: 
328     </p>
329 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
330 <li class="listitem" style="list-style-type: disc">there is an order-preserving mapping from their elements onto a set of consecutive integers, and</li>
331 <li class="listitem" style="list-style-type: disc">duration operations on their values are stable</li>
332 </ul></div>
333 <p> 
334   </p>
335 <p>
336     The practical effect of this is that duration calculations can be implemented with simple integer subtraction. Examples of predictable types are TAI timepoints and Gregorian dates.
337   </p>
338 <p>
339     Unpredictable types have exactly the opposite properties: 
340     </p>
341 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
342 <li class="listitem" style="list-style-type: disc">there is no order-preserving mapping from their elements onto a set of consecutive integers, and</li>
343 <li class="listitem" style="list-style-type: disc">duration operations on their values are not stable. </li>
344 </ul></div>
345 <p> 
346   </p>
347 <p>
348     Examples of unpredictable types are UTC timepoints and Local Time timepoints.
349   </p>
350 <p>
351     We can refine this a little by saying that a range within an unpredicatable type can be predictable, and operations performed entirely on values within that range will be stable. For example, the range of UTC timepoints from 1970-01-01 through the present is predictable, so calculations of durations within that range will be stable. 
352   </p>
353 <h4>
354 <a name="idp180996464"></a>
355     Approximations
356   </h4>
357 <p>
358     These limitations are problematical, because important temporal types like UTC and Local Time are in fact unpredictable, and therefore operations on them are sometimes unstable. Yet as a practical matter we often want to perform this kind of operation, such as computing the duration between two timepoints in the future that are specified in Local Time. 
359   </p>
360 <p>
361     The best the library can do is to provide an approximation, which is generally possible and for most purposes will be good enough. Of course the documentation must specify when an answer will be approximate (and thus unstable) and how big the error may be. In many respects calculating with unpredictable sets is analogous to the use of floating point numbers, for which results are expected to only be approximately correct. Calculating with predictable sets would then be analogous to the user of integers, where results are expected to be exact. 
362   </p>
363 <p>
364     For situations where exact answers are required or instability cannot be tolerated, the user must be able to specify this, and then the library should throw an exception if the user requests a computation for which an exact, stable answer is not possible. 
365   </p>
366 </div>
367 <div class="section">
368 <div class="titlepage"><div><div><h3 class="title">
369 <a name="date_time.terminology"></a>Terminology</h3></div></div></div>
370 <p>
371     The following are a number of terms relevant to the date-time domain. 
372   </p>
373 <p>
374     A taxonomy of temporal types:
375     </p>
376 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
377 <li class="listitem" style="list-style-type: disc">Timepoint -- Specifier for a location in the time continuum. Similar to a number on a ruler.</li>
378 <li class="listitem" style="list-style-type: disc">Timelength -- A duration of time unattached to any point on the time continuum.</li>
379 <li class="listitem" style="list-style-type: disc">Timeinterval -- A duration of time attached to a specific point in the time continuum.</li>
380 </ul></div>
381 <p>
382   </p>
383 <p>
384     And some other terms: 
385     </p>
386 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
387 <li class="listitem" style="list-style-type: disc">Accuracy -- A measure of error, the difference between the reading of a clock and the true time.</li>
388 <li class="listitem" style="list-style-type: disc">Calendar System -- A system for labeling time points with day level resolution.</li>
389 <li class="listitem" style="list-style-type: disc">Clock Device -- A software component (tied to some hardware) that provides the current date or time with respect to a calendar or clock system.</li>
390 <li class="listitem" style="list-style-type: disc">Precision -- A measure of repeatability of a clock.</li>
391 <li class="listitem" style="list-style-type: disc">Resolution -- A specification of the smallest representable duration (eg: 1 second, 1 century) for a clock/calendar system or temporal type.</li>
392 <li class="listitem" style="list-style-type: disc">Stability -- The property of a class which says that the underlying representation (implementation) associated with a particular (abstract) value will never change.</li>
393 <li class="listitem" style="list-style-type: disc">Time System -- A system for labeling time points with higher resolution than day-level. </li>
394 </ul></div>
395 <p>
396   </p>
397 <p>
398     Some standard date-time terminology: 
399     </p>
400 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
401 <li class="listitem" style="list-style-type: disc">Epoch -- Starting time point of a calendar or clock system.</li>
402 <li class="listitem" style="list-style-type: disc">DST -- Daylight savings time - a local time adjustment made in some regions during the summer to shift the clock time of the daylight hours</li>
403 <li class="listitem" style="list-style-type: disc">Time zone -- A region of the earth that provides for a 'local time' defined by DST rules and UT offset.</li>
404 <li class="listitem" style="list-style-type: disc">UTC Time -- Coordinated Universal Time - Civil time system as measured at longitude zero. Kept adjusted to earth rotation by use of leap seconds. Also known as Zulu Time. Replaced the similar system known as Greenwich Mean Time. For more see <a href="http://aa.usno.navy.mil/faq/docs/UT.html" target="_top">http://aa.usno.navy.mil/faq/docs/UT.html</a>
405 </li>
406 <li class="listitem" style="list-style-type: disc">TAI Time -- A high-accuracy monotonic (need better term) time system measured to .1 microsecond resolution by atomic clocks around the world. Not adjusted to earth rotation. For more see <a href="http://www.bipm.fr/enus/5_Scientific/c_time/time_server.html" target="_top">http://www.bipm.fr/enus/5_Scientific/c_time/time_server.html</a>
407 </li>
408 </ul></div>
409 <p>
410   </p>
411 <p>
412     Some more experimental ones: 
413     </p>
414 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
415 <li class="listitem" style="list-style-type: disc">Local Time -- A time measured in a specific location of the universe.</li>
416 <li class="listitem" style="list-style-type: disc">Time Label -- A tuple that either completely or partially specifies a specific date-time with respect to a calendar or clock system. This is the year-month-day representation.</li>
417 <li class="listitem" style="list-style-type: disc">Adjusting Time Length -- A duration that represents varying physical durations depending on the moment in time. For example, a 1 month duration is typically not a fixed number of days and it depends on the date it is measured from to determine the actual length. </li>
418 </ul></div>
419 <p>
420   </p>
421 <p>
422     These are design sorts of terms: 
423     </p>
424 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "><li class="listitem" style="list-style-type: disc">Generation function -- A function that generates a specific set of time points, lengths, or intervals based on one or more parameters. </li></ul></div>
425 <p>
426   </p>
427 </div>
428 <div class="section">
429 <div class="titlepage"><div><div><h3 class="title">
430 <a name="date_time.references"></a>References</h3></div></div></div>
431 <p>The design of the library is currently being evolved using Wiki and email discussions. You can find more information at: <a href="http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?GDTL" target="_top">Boost Wiki GDTL Start Page</a>.
432   </p>
433 <p>
434     </p>
435 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
436 <li class="listitem" style="list-style-type: disc"><a class="link" href="details.html#date_ref">Date References</a></li>
437 <li class="listitem" style="list-style-type: disc"><a class="link" href="details.html#time_ref">Time References</a></li>
438 <li class="listitem" style="list-style-type: disc"><a class="link" href="details.html#other_c_libs">Other C/C++ Libraries</a></li>
439 <li class="listitem" style="list-style-type: disc"><a class="link" href="details.html#java_libs">JAVA Date-Time Libraries</a></li>
440 <li class="listitem" style="list-style-type: disc"><a class="link" href="details.html#script_libs">Scripting Language Libraries</a></li>
441 <li class="listitem" style="list-style-type: disc"><a class="link" href="details.html#related">Related Commercial and Fanciful Pages</a></li>
442 <li class="listitem" style="list-style-type: disc"><a class="link" href="details.html#resolution">Resolution, Precision, and Accuracy</a></li>
443 </ul></div>
444 <p>
445   </p>
446 <a name="date_ref"></a><h4>
447 <a name="idp181030192"></a>Date Calendar References</h4>
448 <p>
449     </p>
450 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
451 <li class="listitem" style="list-style-type: disc">ISO 8601 date time standard -- <a href="http://www.cl.cam.ac.uk/~mgk25/iso-time.html" target="_top">Summary by Markus Kuhn</a>
452 </li>
453 <li class="listitem" style="list-style-type: disc">
454 <a href="http://emr.cs.iit.edu/home/reingold/calendar-book/second-edition/" target="_top">Calendrical Calculations</a> book by Reingold &amp; Dershowitz</li>
455 <li class="listitem" style="list-style-type: disc"><a href="http://www.tondering.dk/claus/calendar.html" target="_top">Calendar FAQ by Claus T&#248;ndering</a></li>
456 <li class="listitem" style="list-style-type: disc">Calendar zone <a href="http://www.calendarzone.com" target="_top">http://www.calendarzone.com</a>
457 </li>
458 <li class="listitem" style="list-style-type: disc"><a href="http://www.w3.org/TR/xmlschema-2/#dateTime" target="_top">XML schema for date time</a></li>
459 <li class="listitem" style="list-style-type: disc">Will Linden's <a href="http://www.ecben.net/calendar.shtml" target="_top">Calendar Links</a>
460 </li>
461 <li class="listitem" style="list-style-type: disc"><a href="http://www21.brinkster.com/lonwolve/melt/index.htm" target="_top">XMAS calendar melt</a></li>
462 </ul></div>
463 <p>
464   </p>
465 <a name="time_ref"></a><h4>
466 <a name="idp181039776"></a>Time</h4>
467 <p>
468     </p>
469 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
470 <li class="listitem" style="list-style-type: disc">Martin Folwer on time patterns
471         <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: opencircle; ">
472 <li class="listitem"><a href="http://www.aw.com/cseng/titles/0-201-89542-0/apsupp/events2-1.html" target="_top">Recurring Events for Calendars</a></li>
473 <li class="listitem">Patterns for things that <a href="http://martinfowler.com/ap2/timeNarrative.html" target="_top">Change with time</a>
474 </li>
475 </ul></div>
476 </li>
477 <li class="listitem" style="list-style-type: disc">US National Institute of Standards and Technology <a href="http://nist.time.gov/exhibits.html" target="_top">Time Exhibits</a>
478 </li>
479 <li class="listitem" style="list-style-type: disc">Network Time Protocol at <a href="http://www.ntp.org/" target="_top">NTP.org</a>
480 </li>
481 <li class="listitem" style="list-style-type: disc">US Navy <a href="http://tycho.usno.navy.mil/systime.html" target="_top">Systems of Time</a>
482 </li>
483 <li class="listitem" style="list-style-type: disc"><a href="http://www.bipm.fr/enus/5_Scientific/c_time/time_1.html" target="_top">International Atomic Time</a></li>
484 <li class="listitem" style="list-style-type: disc">
485 <a href="http://beta.zyprexia.com/docs/pgsql/user/datatype1130.htm" target="_top">Date-Time type PostgreSQL</a> User Guide </li>
486 </ul></div>
487 <p>
488   </p>
489 <a name="other_c_libs"></a><h4>
490 <a name="idp181050864"></a>Other C/C++ Libraries</h4>
491 <p>
492     </p>
493 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
494 <li class="listitem" style="list-style-type: disc">
495 <a href="http://www.cplusplus.com/ref/ctime/index.html" target="_top">ctime C</a> Standard library reference at cplusplus.com</li>
496 <li class="listitem" style="list-style-type: disc">
497 <a href="http://www.cl.cam.ac.uk/~mgk25/c-time/" target="_top">XTime C extension</a> proposal</li>
498 <li class="listitem" style="list-style-type: disc">
499 <a href="http://david.tribble.com/text/c0xcalendar.html#author-info" target="_top">Another C library extension proposal</a> by David Tribble</li>
500 <li class="listitem" style="list-style-type: disc">
501 <a href="http://cr.yp.to/libtai.html" target="_top">libTAI</a> is a C based time library</li>
502 <li class="listitem" style="list-style-type: disc">
503 <a href="http://www.twinsun.com/tz/tz-link.htm" target="_top">Time Zone Database</a> C library for managing timezones/places</li>
504 <li class="listitem" style="list-style-type: disc">International Components for Unicode by IBM (open source)
505         <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: opencircle; ">
506 <li class="listitem"><a href="http://icu.sourceforge.net/userguide/dateCalendar.html" target="_top">Calendar Class</a></li>
507 <li class="listitem"><a href="http://icu.sourceforge.net/userguide/dateTime.html" target="_top">Date Time Services</a></li>
508 <li class="listitem"><a href="http://oss.software.ibm.com/userguide/dateTimezone.html" target="_top">Time Zone Class</a></li>
509 <li class="listitem"><a href="http://oss.software.ibm.com/userguide/formatDateTime.html" target="_top">Date-Time Formatting</a></li>
510 </ul></div>
511 </li>
512 <li class="listitem" style="list-style-type: disc"><a href="http://pds-rings.seti.org/toolkits/julian_133_html/aareadme.html" target="_top">Julian Library in C by Mark Showalter -- NASA</a></li>
513 </ul></div>
514 <p>
515   </p>
516 <a name="java_libs"></a><h4>
517 <a name="idp181063808"></a>JAVA Date &amp; Time Library Quick Reference</h4>
518 <p>
519     </p>
520 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
521 <li class="listitem" style="list-style-type: disc"><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Calendar.html" target="_top">Calendar class</a></li>
522 <li class="listitem" style="list-style-type: disc"><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/GregorianCalendar.html" target="_top">Gregorian calendar</a></li>
523 <li class="listitem" style="list-style-type: disc"><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Date.html" target="_top">Date class</a></li>
524 <li class="listitem" style="list-style-type: disc"><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Time.html" target="_top">sql.time class</a></li>
525 <li class="listitem" style="list-style-type: disc"><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/DateFormatSymbols.html#_top_" target="_top">Date format symbols</a></li>
526 <li class="listitem" style="list-style-type: disc"><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/DateFormat.html" target="_top">Date format</a></li>
527 <li class="listitem" style="list-style-type: disc"><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/SimpleDateFormat.html" target="_top">Simple Date Format</a></li>
528 <li class="listitem" style="list-style-type: disc"><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/SimpleTimeZone.html" target="_top">Simple Time Zone</a></li>
529 </ul></div>
530 <p>
531   </p>
532 <a name="script_libs"></a><h4>
533 <a name="idp181073264"></a>Scripting Language Libraries</h4>
534 <p>
535     </p>
536 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
537 <li class="listitem" style="list-style-type: disc">A python date library <a href="http://www.lemburg.com/files/python/mxDateTime.html" target="_top">MX Date Time</a>
538 </li>
539 <li class="listitem" style="list-style-type: disc">Perl date-time
540         <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: opencircle; ">
541 <li class="listitem"><a href="http://search-dev.develooper.com/search?m=module&amp;q=date&amp;s=11" target="_top">Date-Time packages at CPAN</a></li>
542 <li class="listitem">
543 <a href="http://search-dev.develooper.com/~stbey/Date-Calc-5.4/Calc.pod" target="_top">Date::Calc</a> at CPAN</li>
544 <li class="listitem">
545 <a href="http://search.cpan.org/doc/MORTY/DateConvert-0.16/Convert.pm" target="_top">Date::Convert</a> calendar conversions at CPAN</li>
546 </ul></div>
547 </li>
548 </ul></div>
549 <p>
550   </p>
551 <a name="related"></a><h4>
552 <a name="idp181080720"></a>Related Commercial and Fanciful Pages</h4>
553 <p>
554     </p>
555 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
556 <li class="listitem" style="list-style-type: disc">
557 <a href="http://www.craphound.com/est/" target="_top">Eastern Standard Tribe</a> -- Cory Doctorow science fiction novel with time themes.</li>
558 <li class="listitem" style="list-style-type: disc">
559 <a href="http://www.leapsecond.com/java/gpsclock.htm" target="_top">Leapsecond.com time</a> page</li>
560 <li class="listitem" style="list-style-type: disc"><a href="http://www.worldtimeserver.com" target="_top">World Time Server / TZ database</a></li>
561 <li class="listitem" style="list-style-type: disc">
562 <a href="http://www.longnow.org/10kclock/clock.htm" target="_top">10000 year clock</a> at Long Now Foundation</li>
563 <li class="listitem" style="list-style-type: disc"><a href="http://www.timezonesforpcs.com" target="_top">Timezones for PCs</a></li>
564 </ul></div>
565 <p>
566   </p>
567 <a name="resolution"></a><h4>
568 <a name="idp181087888"></a>Resolution, Precision, and Accuracy</h4>
569 <p>
570     </p>
571 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
572 <li class="listitem" style="list-style-type: disc">Definitions with pictures from <a href="http://metrologyforum.tm.agilent.com/specs.shtml" target="_top">Agilent Technologies</a>
573 </li>
574 <li class="listitem" style="list-style-type: disc">Definitions from <a href="http://www.solent.ac.uk/hydrography/notes/errorthe/accuracy.htm" target="_top">Southampton Institute</a>
575 </li>
576 </ul></div>
577 <p>
578   </p>
579 </div>
580 <div class="section">
581 <div class="titlepage"><div><div><h3 class="title">
582 <a name="date_time.buildinfo"></a>Build-Compiler Information</h3></div></div></div>
583 <p>
584     <a class="link" href="details.html#overview">Overview</a> --
585     <a class="link" href="details.html#compile_options">Compilation Options</a> --
586     <a class="link" href="details.html#portability">Compiler/Portability Notes</a> --
587     <a class="link" href="details.html#dir_structure">Directory Structure</a> --
588     <a class="link" href="details.html#other_boost_libs">Required Boost Libraries</a>
589   </p>
590 <a name="overview"></a><h4>
591 <a name="idp181098800"></a>Overview</h4>
592 <p>
593     The library has a few functions that require the creation of a library file (mostly to_string, from_string functions).  Most library users can make effective use of the library WITHOUT building the library, but simply including the required headers. If the library is needed, the Jamfile in the build directory will produce a "static" library (libboost_date_time) and a "dynamic/shared" library (boost_date_time) that contains these functions. Note that to use the library without the library (particularly on windows) may require using the BOOST_DATE_TIME_NO_LIB flag to the compilation options.
594   </p>
595 <a name="compile_options"></a><h4>
596 <a name="idp181101184"></a>Compilation Options</h4>
597 <p>
598     By default the posix_time system uses a single 64 bit integer internally to provide a microsecond level resolution. As an alternative, a combination of a 64 bit integer and a 32 bit integer (96 bit resolution) can be used to provide nano-second level resolutions. The default implementation may provide better performance and more compact memory usage for many applications that do not require nano-second resolutions. 
599   </p>
600 <p>
601     To use the alternate resolution (96 bit nanosecond) the variable <code class="computeroutput">BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG</code> must be defined in the library users project files (ie Makefile, Jamfile, etc). This macro is not used by the Gregorian system and therefore has no effect when building the library.
602   </p>
603 <p>As of version 1.33, the date_time library introduced a new IO streaming system. Some compilers are not capable of utilizing this new system. For those compilers the earlier ("legacy") IO system is still available. Non-supported compilers will select the legacy system automatically but the user can force the usage of the legacy system by defining <code class="computeroutput">USE_DATE_TIME_PRE_1_33_FACET_IO</code>.</p>
604 <p>As a convenience, <code class="computeroutput">date_time</code> has provided some <a class="link" href="gregorian.html#additional_duration_types">additional duration types</a>. Use of these types may have unexpected results due to the snap-to-end-of-month behavior (see <a class="link" href="gregorian.html#snap_to_details">Reversibility of Operations Pitfall</a> for complete details and examples). These types are enabled by default. To disable these types, simply undefine <code class="computeroutput">BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES</code> in your project file.</p>
605 <p>Another convenience is the default constructors for <code class="computeroutput"><a class="link" href="gregorian.html#date_time.gregorian.date_class" title="Date">date</a></code>, and <code class="computeroutput"><a class="link" href="posix_time.html#date_time.posix_time.ptime_class" title="Ptime">ptime</a></code>. These constructors are enabled by default. To disable them, simply define <code class="computeroutput">DATE_TIME_NO_DEFAULT_CONSTRUCTOR</code> in your project file.</p>
606 <a name="portability"></a><h4>
607 <a name="idp181113792"></a>Compiler/Portability Notes</h4>
608 <p>
609     The Boost Date-Time library has been built and tested with many compilers and platforms. However, some compilers and standard libraries have issues. While some of these issues can be worked around, others are difficult to work around. The following compilers are known to fully support all aspects of the library:
610     </p>
611 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
612 <li class="listitem" style="list-style-type: disc">Codewarrior 9.4 Windows</li>
613 <li class="listitem" style="list-style-type: disc">GCC 3.2 - 3.4, 4.x on Linux</li>
614 <li class="listitem" style="list-style-type: disc">GCC 3.3, 4.x on Darwin</li>
615 <li class="listitem" style="list-style-type: disc">GCC 3.3 - 3.4, 4.x on Solaris</li>
616 <li class="listitem" style="list-style-type: disc">GCC 3.3, 4.x  on HP-UX</li>
617 <li class="listitem" style="list-style-type: disc">QCC 3.3.5 on QNX</li>
618 <li class="listitem" style="list-style-type: disc">MSVC 7.1 Windows </li>
619 <li class="listitem" style="list-style-type: disc">Intel 8.1-9.x Linux and Windows</li>
620 </ul></div>
621 <p>
622   </p>
623 <p>
624      Unfortunately, the VC8 compiler has some issues with date-time code.  
625      The most serious issue is a memory leak which was introduced into the
626      VC8 standard library basic_stream code.  Date-time has code has been changed
627      to avoid this as much as possible, but if you are using the legacy IO option 
628      (NOT the default with VC8) then the issue can still arise.  See the
629
630      <a href="http://lists.boost.org/Archives/boost/2006/02/101122.php" target="_top">mailing list archive</a> for more details.
631   </p>
632 <p>
633      In addition to the problem above, some versions of the VC8 library have limited 
634      the range of allowed 
635      values in the <code class="computeroutput">std::tm</code> structure to positive values.  This was a new 
636      restriction added in the VC8.  The effect is that dates prior to the year
637      1900 will cause exceptions.  There is, unfortunately, no easy workaround for 
638      this issue.  Note that the new 64bit version of the VC8 compiler
639      does not appear to have this limitation.  
640   </p>
641 <p>
642     These compilers support all aspects of the library except <code class="computeroutput">wstring/wstream</code> 
643     output.
644     </p>
645 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
646 <li class="listitem" style="list-style-type: disc">MinGW 3.2, 3.4, 3.5 *</li>
647 <li class="listitem" style="list-style-type: disc">GCC 3.2 (cygwin) *</li>
648 </ul></div>
649 <p>
650   </p>
651 <p>
652     In particular, a lack of support for standard locales limits the ability of the library to support iostream based input output. For these compilers a set of more limited string based input-output is provided. Some compilers/standard libraries with this limitation include: 
653     </p>
654 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "><li class="listitem" style="list-style-type: disc">Borland 5.6</li></ul></div>
655 <p>
656   </p>
657 <p>
658     Official support for some older compilers has now been dropped.  This includes:
659     </p>
660 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
661 <li class="listitem" style="list-style-type: disc">GCC 2.9x</li>
662 <li class="listitem" style="list-style-type: disc">Borland 5.1.1</li>
663 <li class="listitem" style="list-style-type: disc">MSVC 7.0 and 6 SP5 </li>
664 </ul></div>
665 <p>
666   </p>
667 <h6>
668 <a name="idp181129184"></a>Visual Studio &amp; STLPort</h6>
669 <p>There is a known issue with Visual Studio (7.0 &amp; 7.1) and STLPort. The build errors typically make reference to a type issue or 'no acceptable conversion' and are attempting to instantiate a template with <code class="computeroutput">wchar_t</code>. The default build of STLPort does not support <code class="computeroutput">wchar_t</code>. There are two possible workarounds for this issue. The simplest is the user can build date_time with no wide stream/string etc. The other is to rebuild STLPort with wchar_t support.
670   </p>
671 <p>To build date_time with no wide stream/string etc, execute the following command from <code class="computeroutput">$BOOST_ROOT</code>:
672     </p>
673 <pre class="screen">bjam -a "-sTOOLS=vc-7_1-stlport" "-sSTLPORT_PATH=..." \
674      "-sBUILD=&lt;define&gt;BOOST_NO_STD_WSTRING"           \
675      --stagedir=... --with-date_time stage</pre>
676 <p>
677     (replace the ellipsis with the correct paths for the build system and adjust the <code class="computeroutput">TOOLS</code> to the proper toolset if necessary)
678   </p>
679 <p>Rebuilding STLPort with <code class="computeroutput">wchar_t</code> support involves placing <code class="computeroutput">/Zc:wchar_t</code> in the STLPort makefile. Date_time should then be built with the following command from <code class="computeroutput">$BOOST_ROOT</code>:
680     </p>
681 <pre class="screen">bjam -a "-sTOOLS=vc-7_1-stlport" "-sSTLPORT_PATH=..." \
682      "-sBUILD=&amp;native-wchar_t&gt;on"                     \
683      --stagedir=... --with-date_time stage</pre>
684 <p>
685     (replace the ellipsis with the correct paths for the build system and adjust the <code class="computeroutput">TOOLS</code> to the proper toolset if necessary)
686   </p>
687 <a name="dir_structure"></a><h4>
688 <a name="idp181140912"></a>Directory Structure</h4>
689 <p>
690     The directory tree has the following structure:
691     </p>
692 <pre class="programlisting">/boost/date_time                    -- common headers and template code
693 /boost/date_time/gregorian          -- Gregorian date system header files
694 /boost/date_time/posix_time         -- Posix time system headers
695 /boost/date_time/local_time         -- Local time system headers
696 /libs/date_time/build               -- build files and output directory
697 /libs/date_time/test                -- test battery for generic code
698 /libs/date_time/test/gregorian      -- test battery for the Gregorian system
699 /libs/date_time/test/posix_time     -- test battery for the posix_time system
700 /libs/date_time/test/local_time     -- test battery for the local_time system
701 /libs/date_time/examples/gregorian  -- example programs for dates
702 /libs/date_time/examples/posix_time -- time example programs
703 /libs/date_time/examples/local_time -- nifty example programs
704 /libs/date_time/src/gregorian       -- cpp files for libboost_date_time
705 /libs/date_time/src/posix_time      -- empty (one file, but no source code...)</pre>
706 <p>
707   </p>
708 <a name="other_boost_libs"></a><h4>
709 <a name="idp181144352"></a>Required Boost Libraries</h4>
710 <p>
711     Various parts of date-time depend on other boost libraries.  These include:
712     </p>
713 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; ">
714 <li class="listitem" style="list-style-type: disc"><a href="../../../libs/tokenizer/index.html" target="_top">boost.tokenizer</a></li>
715 <li class="listitem" style="list-style-type: disc"><a href="../../../libs/integer/doc/html/boost_integer/cstdint.html" target="_top">boost.integer(cstdint)</a></li>
716 <li class="listitem" style="list-style-type: disc"><a href="../../../libs/utility/operators.htm" target="_top">boost.operators</a></li>
717 <li class="listitem" style="list-style-type: disc"><a href="../../../libs/conversion/lexical_cast.htm" target="_top">boost.lexical_cast </a></li>
718 <li class="listitem" style="list-style-type: disc"><a href="../../../libs/smart_ptr/smart_ptr.htm" target="_top">boost.smart_ptr (local time only)</a></li>
719 <li class="listitem" style="list-style-type: disc"><a href="../../../libs/algorithm/string/index.html" target="_top">boost::string_algorithms </a></li>
720 <li class="listitem" style="list-style-type: disc"><a href="../../../libs/serialization/index.html" target="_top">boost::serialize (serialization code only) </a></li>
721 </ul></div>
722 <p>
723     so these libraries need to be installed. 
724   </p>
725 </div>
726 <div class="section">
727 <div class="titlepage"><div><div><h3 class="title">
728 <a name="date_time.tests"></a>Tests</h3></div></div></div>
729 <p>
730     The library provides a large number of tests in the 
731     </p>
732 <pre class="programlisting">
733       libs/date_time/test
734       libs/date_time/test/gregorian
735       libs/date_time/test/posix_time
736       libs/date_time/test/local_time
737     </pre>
738 <p>
739     directories. Building and executing these tests assures that the installation is correct and that the library is functioning correctly. In addition, these tests facilitate the porting to new compilers. Finally, the tests provide examples of many functions not explicitly described in the usage examples. 
740   </p>
741 </div>
742 <div class="section">
743 <div class="titlepage"><div><div><h3 class="title">
744 <a name="date_time.changes"></a>Change History</h3></div></div></div>
745 <h4>
746 <a name="idp181157200"></a>Changes from Boost 1.41 to 1.44 (date_time 1.08 to 1.09)</h4>
747 <div class="informaltable"><table class="table">
748 <colgroup>
749 <col>
750 <col>
751 </colgroup>
752 <thead><tr>
753 <th>Type</th>
754 <th>Description</th>
755 </tr></thead>
756 <tbody><tr>
757 <td>Bug fix</td>
758 <td>
759             The "%T" and "%R" format specifiers are now processed by the library rather than underlying standard facet.
760             This fixes the cases when the placeholders are not supported by the facet
761             (<a href="https://svn.boost.org/trac/boost/ticket/3876" target="_top">#3876</a>).
762           </td>
763 </tr></tbody>
764 </table></div>
765 <h4>
766 <a name="idp181163344"></a>Changes from Boost 1.40 to 1.41 (date_time 1.07 to 1.08)</h4>
767 <div class="informaltable"><table class="table">
768 <colgroup>
769 <col>
770 <col>
771 </colgroup>
772 <thead><tr>
773 <th>Type</th>
774 <th>Description</th>
775 </tr></thead>
776 <tbody>
777 <tr>
778 <td>Change</td>
779 <td>
780             The default format for time durations is now "%-%O:%M:%S%F" instead of "%-%H:%M:%S%F" that was used previously. In order to retain the old behavior, the format string has to be specified explicitly during the time IO facet construction (<a href="https://svn.boost.org/trac/boost/ticket/1861" target="_top">#1861</a>).
781           </td>
782 </tr>
783 <tr>
784 <td>Bug fix</td>
785 <td>
786             Gregorian dates now use 32-bit integer type internally on 64-bit platforms (<a href="https://svn.boost.org/trac/boost/ticket/3308" target="_top">#3308</a>).
787           </td>
788 </tr>
789 <tr>
790 <td>Bug fix</td>
791 <td>
792             Adjusted UTC time zone offset boundaries in order to allow offsets up to +14 hours (<a href="https://svn.boost.org/trac/boost/ticket/2213" target="_top">#2213</a>).
793           </td>
794 </tr>
795 </tbody>
796 </table></div>
797 <h4>
798 <a name="idp181173616"></a>Changes from Boost 1.38 to 1.40 (date_time 1.06 to 1.07)</h4>
799 <div class="informaltable"><table class="table">
800 <colgroup>
801 <col>
802 <col>
803 </colgroup>
804 <thead><tr>
805 <th>Type</th>
806 <th>Description</th>
807 </tr></thead>
808 <tbody><tr>
809 <td>Bug fix</td>
810 <td>
811             Minor bug fixes (<a href="https://svn.boost.org/trac/boost/ticket/2809" target="_top">#2809</a>,
812             <a href="https://svn.boost.org/trac/boost/ticket/2824" target="_top">#2824</a>,
813             <a href="https://svn.boost.org/trac/boost/ticket/3015" target="_top">#3015</a>,
814             <a href="https://svn.boost.org/trac/boost/ticket/3105" target="_top">#3105</a> and others).
815           </td>
816 </tr></tbody>
817 </table></div>
818 <h4>
819 <a name="idp181181840"></a>Changes from Boost 1.34 to 1.38 (date_time 1.05 to 1.06)</h4>
820 <div class="informaltable"><table class="table">
821 <colgroup>
822 <col>
823 <col>
824 </colgroup>
825 <thead><tr>
826 <th>Type</th>
827 <th>Description</th>
828 </tr></thead>
829 <tbody>
830 <tr>
831 <td>Feature</td>
832 <td>
833             Added support for formatting and reading time durations longer than 24 hours.
834             A new formatter <code class="computeroutput">%O</code> is used indicate such long durations in the
835             format string. The old <code class="computeroutput">%H</code> format specifier is thus restricted
836             to represent durations that fit into two characters, in order to retain support
837             for reading durations in ISO format. In case if it is detected that the <code class="computeroutput">%H</code>
838             format specifier is used with longer durations, the results are not specified
839             (an assertion in debug builds is raised).
840           </td>
841 </tr>
842 <tr>
843 <td>Bug fix</td>
844 <td>
845             Added support for GCC 4.3. Several compilation issues were solved, as well as
846             compiler warnings were taken care of.
847           </td>
848 </tr>
849 <tr>
850 <td>Bug fix</td>
851 <td>
852             Added missing streaming operators for the <code class="computeroutput">local_time_period</code> class.
853           </td>
854 </tr>
855 <tr>
856 <td>Bug fix</td>
857 <td>
858             Added several missing includes in different places. Some includes that are
859             not needed in some configurations were made conditional.
860           </td>
861 </tr>
862 <tr>
863 <td>Bug fix</td>
864 <td>
865             Solved compilation problem that was caused by not finding streaming operators
866             for <code class="computeroutput">gregorian::date_duration</code> via ADL. The type is now made actually
867             a class rather a typedef for the <code class="computeroutput">date_time::date_duration</code> template.
868             The similar change was done for <code class="computeroutput">gregorian::weeks</code>.
869           </td>
870 </tr>
871 <tr>
872 <td>Bug fix</td>
873 <td>
874             Added a correctly spelled <code class="computeroutput">date_time::hundredth</code> time resolution enum
875             value. The old one <code class="computeroutput">date_time::hundreth</code> is considered deprecated and
876             to be removed in future releases.
877           </td>
878 </tr>
879 <tr>
880 <td>Bug fix</td>
881 <td>
882             Fixed compilation error in <code class="computeroutput">format_date_parser.hpp</code> because of incorrect
883             stream type being used.
884           </td>
885 </tr>
886 <tr>
887 <td>Bug fix</td>
888 <td>
889             On Windows platform made inclusion of <code class="computeroutput">windows.h</code> optional. The header is only used
890             when the <code class="computeroutput">BOOST_USE_WINDOWS_H</code> macro is defined. Otherwise (and by default),
891             the library uses internal definitions of symbols from this header.
892           </td>
893 </tr>
894 <tr>
895 <td>Bug fix</td>
896 <td>
897             On Windows platform function <code class="computeroutput">from_ftime</code> could return incorrect time if
898             the <code class="computeroutput">FILETIME</code> that is being passed to the function contained dates before 1970-Jan-01.
899           </td>
900 </tr>
901 <tr>
902 <td>Bug fix</td>
903 <td>
904             Fixed a possible crash in <code class="computeroutput">gregorian::special_value_from_string</code> if the string
905             did not represent a valid special value.
906           </td>
907 </tr>
908 <tr>
909 <td>Bug fix</td>
910 <td>
911             Removed the <code class="computeroutput">testfrmwk.hpp</code> file from the public include directory. This file
912             was internal for the library tests and was not documented.
913           </td>
914 </tr>
915 <tr>
916 <td>Bug fix</td>
917 <td>
918             Fixed missing include in <code class="computeroutput">filetime_functions.hpp</code>
919             (<a href="https://svn.boost.org/trac/boost/ticket/2688" target="_top">#2688</a>).
920           </td>
921 </tr>
922 <tr>
923 <td>Bug fix</td>
924 <td>
925             Fixed dereferencing end string iterators in different places of code,
926             which could cause crashes on MSVC
927             (<a href="https://svn.boost.org/trac/boost/ticket/2698" target="_top">#2698</a>).
928           </td>
929 </tr>
930 </tbody>
931 </table></div>
932 <h4>
933 <a name="idp181217232"></a>Changes from Boost 1.33 to 1.34 (date_time 1.04 to 1.05)</h4>
934 <div class="informaltable"><table class="table">
935 <colgroup>
936 <col>
937 <col>
938 </colgroup>
939 <thead><tr>
940 <th>Type</th>
941 <th>Description</th>
942 </tr></thead>
943 <tbody>
944 <tr>
945 <td>Feature</td>
946 <td>
947              Updated the data in the date_time_zonespec.csv file to reflect new US/Canada
948              daylight savings time rules for 2007.  If you upgrade to the new file, be aware
949              that the library will only give correct answers for current/future date
950              conversions.  So if you are converting dates from earlier years the answers
951              will reflect current time zone rules not past rules.  The library doesn't support
952              historic timezone rules presently.
953           </td>
954 </tr>
955 <tr>
956 <td>Feature</td>
957 <td>
958               Two other dst calculation features have also been update to reflect the new
959               US/Canada timzone rules. This is the boost::date_time::us_dst_rules and
960               dst_calc_engine.  While the us_dst_rules is officially deprecated, a patch
961               by Graham Bennett has been applied which allows this class to work correctly
962               for both historical and future dates.  The dst_calc_engine was updated to also
963               work for historical and future times.  This allows the various local_adjustor
964               classes to work correctly.  There was an interface change for classes using the
965               dst_calc_engine with custom dst traits classes.  The traits classes signatures
966               changed to take a 'year' parameter on most of the methods such as end_month.
967               In addition,  2 new functions are needed on the traits classes:
968                    <code class="computeroutput">static date_type local_dst_start_day(year_type year)</code> and
969                    <code class="computeroutput">static date_type local_dst_end_day(year_type year)</code>.
970               Implementers should see <code class="computeroutput">date_time/local_timezone_defs.hpp</code> for
971               examples.
972           </td>
973 </tr>
974 <tr>
975 <td>Bug Fix</td>
976 <td>Fix DST traits for Austrialia (sf# 1672139) to set end of DST at 3:00 am instead of 2:00 am.
977           </td>
978 </tr>
979 <tr>
980 <td>Bug Fix</td>
981 <td>Fix a problem with potential linking error with multiple definitions due
982                  to I/O code.
983           </td>
984 </tr>
985 <tr>
986 <td>Bug Fix</td>
987 <td>Changed serialization code in both greg_serialize.hpp and time_serialize.hpp
988                  to eliminate warnings due to unused variables for version and file_version.
989                  Thanks to Caleb Epstein for the patch suggestion.
990           </td>
991 </tr>
992 <tr>
993 <td>Bug Fix</td>
994 <td>Fix regression errors that showed up under FreeBSD with GCC and the
995                  LANG environment set to russian -- changed parser to use classic
996                  locale instead of blank locale.
997           </td>
998 </tr>
999 <tr>
1000 <td>Bug Fix</td>
1001 <td>Changes for tracker issue 1178092 -- change in convert_to_lower to make
1002                  local a const static and speed up parsing.
1003           </td>
1004 </tr>
1005 <tr>
1006 <td>Bug Fix</td>
1007 <td>Patches from Ulrich Eckhardt to fix support for EVC++ 4.
1008           </td>
1009 </tr>
1010 <tr>
1011 <td>Feature</td>
1012 <td>Reduce the usage of basic_stringstream as much a possible to work around
1013                  a bug in the VC8 standard library. See
1014                  <a href="http://lists.boost.org/Archives/boost/2006/02/101122.php" target="_top">mailing list archive</a>
1015                  for more information.
1016           </td>
1017 </tr>
1018 </tbody>
1019 </table></div>
1020 <h4>
1021 <a name="idp181238048"></a>Changes from Boost 1.32 to 1.33 (date_time 1.03 to 1.04)</h4>
1022 <div class="informaltable"><table class="table">
1023 <colgroup>
1024 <col>
1025 <col>
1026 </colgroup>
1027 <thead><tr>
1028 <th>Type</th>
1029 <th>Description</th>
1030 </tr></thead>
1031 <tbody>
1032 <tr>
1033 <td>Bug Fix</td>
1034 <td>Period lengths, when beginning and end points are the same, or are consecutive, were being incorrectly calculated. The corrected behavior, where end and beginning points are equal, or a period is created with a zero duration, now return a length of zero. A period where beginning and end points are consecutive will return a length of one.
1035           </td>
1036 </tr>
1037 <tr>
1038 <td>Bug Fix</td>
1039 <td>Time_input_facet was missing functions to set iso formats. It also failed to parse time values that did not use a separator (%H%M%S). Both these bugs have been corrected.
1040           </td>
1041 </tr>
1042 <tr>
1043 <td>Feature</td>
1044 <td>Preliminary names of ptime_facet and ptime_input_facet changed to simply time_facet and time_input_facet. The ptime_* versions have been removed all together.
1045           </td>
1046 </tr>
1047 <tr>
1048 <td>Feature</td>
1049 <td>The from_iso_string function failed to parse fractional digits. We added code that correctly parses when input has more digits, or too few digits, that the compiled library precision. Ptimes with only a decimal are also correctly parsed.
1050           </td>
1051 </tr>
1052 <tr>
1053 <td>Bug Fix</td>
1054 <td>The parsing mechanism in the new IO would consume the next character after a match was made. This bug presented itself when attempting to parse a period that had special value for it's beginning point.
1055           </td>
1056 </tr>
1057 <tr>
1058 <td>Bug Fix</td>
1059 <td>The new IO system failed to provide the ability for the user to "turn on" exceptions on the stream. The failbit was also not set when parsing failed. Both of these problems have been fixed.
1060           </td>
1061 </tr>
1062 <tr>
1063 <td>Bug Fix</td>
1064 <td>Parsing of special values, by means of from_*_string functions, has been fixed. This also effects the libraries ability to serialize special values. Time_duration now serializes as either a string or individual fields (depending on is_special()).
1065           </td>
1066 </tr>
1067 <tr>
1068 <td>Bug Fix</td>
1069 <td>Previously, output streaming of <code class="computeroutput">partial_date</code> would display the day as either a single or double digit integer (ie '1', or '12'). This has been corrected to always display a double digit integer (ie '01').
1070           </td>
1071 </tr>
1072 <tr>
1073 <td>Feature</td>
1074 <td>Major new features related to management of local times.
1075                  This includes the introduction of a series of new classes to
1076                  represent time zones and local times (see <a class="link" href="local_time.html" title="Local Time">Date Time Local Time</a> for complete details).
1077           </td>
1078 </tr>
1079 <tr>
1080 <td>Feature</td>
1081 <td>Input and output facets have been re-written to support format-based
1082             redefinition of formats (see <a class="link" href="date_time_io.html" title="Date Time Input/Output">Date Time IO</a> for complete details).
1083           </td>
1084 </tr>
1085 <tr>
1086 <td>Feature</td>
1087 <td>Functions have been added to facilitate conversions between <code class="computeroutput">tm</code> structs for <code class="computeroutput">date</code>, <code class="computeroutput">ptime</code>, <code class="computeroutput">time_duration</code>, and <code class="computeroutput">local_date_time</code>. Functions for converting <code class="computeroutput">FILETIME</code>, and <code class="computeroutput">time_t</code> to <code class="computeroutput">ptime</code> are also provided. See the individual sections for details.
1088           </td>
1089 </tr>
1090 <tr>
1091 <td>Feature</td>
1092 <td>A <code class="computeroutput">universal_time</code> function has been added to the <code class="computeroutput">microsec_time_clock</code> (full details of this function can be found <a class="link" href="posix_time.html#ptime_from_clock">here</a>).
1093           </td>
1094 </tr>
1095 <tr>
1096 <td>Feature</td>
1097 <td>Functions have been added to facilitate conversions between <code class="computeroutput">tm</code> structs for <code class="computeroutput">date</code>, <code class="computeroutput">ptime</code>, <code class="computeroutput">time_duration</code>, and <code class="computeroutput">local_date_time</code>. Functions for converting <code class="computeroutput">FILETIME</code>, and <code class="computeroutput">time_t</code> to <code class="computeroutput">ptime</code> are also provided. See the individual sections for details.
1098           </td>
1099 </tr>
1100 <tr>
1101 <td>Feature</td>
1102 <td>A <code class="computeroutput">universal_time</code> function has been added to the <code class="computeroutput">microsec_time_clock</code> (full details of this function can be found <a class="link" href="posix_time.html#ptime_from_clock">here</a>).
1103           </td>
1104 </tr>
1105 <tr>
1106 <td>Feature</td>
1107 <td>Date-time now uses reentrant POSIX functions on those platforms that
1108                  support them when BOOST_HAS_THREADS is defined.
1109           </td>
1110 </tr>
1111 <tr>
1112 <td>Bug Fix</td>
1113 <td>Fixed a bug in serialization code where special values
1114                 (not-a-date-time, infinities, etc) for
1115                 ptime, time_duration would not read back correctly from an archive.
1116                 The output serialization code wrote subfields such
1117                 as time_duration.seconds() which are invalid for special values and
1118                 thus undefined values.  Thus when read back the values could cause
1119                 strange behavior including execeptions on construction.
1120           </td>
1121 </tr>
1122 <tr>
1123 <td>Bug Fix</td>
1124 <td>Fixed multiple warnings generated with various platforms/compilers.
1125           </td>
1126 </tr>
1127 <tr>
1128 <td>Bug Fix</td>
1129 <td>Construction of a ptime with a time_duration beyond the range of 00:00 to 23:59:59.9... now adjusts the date and time to make the time_duration fall within this range (ie <code class="computeroutput">ptime(date(2005,2,1), hours(-5))</code> -&gt; "2005-Jan-31 19:00:00" &amp; <code class="computeroutput">ptime(date(2005,2,1), hours(35))</code> -&gt; "2005-Feb-02 11:00:00").
1130           </td>
1131 </tr>
1132 <tr>
1133 <td>Bug Fix</td>
1134 <td>Time parsing now correctly handles excessive digits for fractional seconds. Leading zeros are dropped ("000100" -&gt; 100 frac_sec), and excessive digits are truncated at the proper place ("123456789876" -&gt; 123456 or 123456789 depending on what precision the library was compiled with).
1135           </td>
1136 </tr>
1137 <tr>
1138 <td>Bug Fix</td>
1139 <td>Changes to the <code class="computeroutput">boost::serialization</code> interface broke serialization compatibility for <code class="computeroutput">date_time</code>. The user must provide a function to insure <code class="computeroutput">date_time</code> objects are <code class="computeroutput">const</code> before they are serialized. The function should be similar to:
1140             <pre class="screen">template&lt;class archive_type, class temporal_type&gt;
1141 void save_to(archive_type&amp; ar,
1142              const temporal_type&amp; tt)
1143 {
1144   ar &lt;&lt; tt;
1145 }</pre>
1146           </td>
1147 </tr>
1148 <tr>
1149 <td>Bug Fix</td>
1150 <td>Use of the depricated <code class="computeroutput">boost::tokenizer</code> interface has been updated to the current interface. This fixes compiler errors on some older compilers.
1151           </td>
1152 </tr>
1153 <tr>
1154 <td>Bug Fix</td>
1155 <td>Templatized formatters in the legacy IO system to accept char type. Also removed calls to <code class="computeroutput">boost::lexical_cast</code>.
1156           </td>
1157 </tr>
1158 </tbody>
1159 </table></div>
1160 <h4>
1161 <a name="idp181297888"></a>Changes from Boost 1.31 to 1.32 (date_time 1.02 to 1.03)</h4>
1162 <div class="informaltable"><table class="table">
1163 <colgroup>
1164 <col>
1165 <col>
1166 </colgroup>
1167 <thead><tr>
1168 <th>Type</th>
1169 <th>Description</th>
1170 </tr></thead>
1171 <tbody>
1172 <tr>
1173 <td>Bug Fix</td>
1174 <td>Snap to end of month behavior corrected for year_functor. Previously, starting
1175                  from 2000-Feb-28 (leap year and not end of month) and iterating through the next
1176                  leap year would result in 2004-Feb-29 instead of 2004-Feb-28. This behavior has
1177                  been corrected to produce the correct result of 2004-Feb-28. Thanks to Bart Garst
1178                  for this change.
1179           </td>
1180 </tr>
1181 <tr>
1182 <td>Feature</td>
1183 <td>Free function for creating a ptime object from a FILETIME struct. This function
1184                  is only available on platforms that define BOOST_HAS_FTIME.
1185           </td>
1186 </tr>
1187 <tr>
1188 <td>Feature</td>
1189 <td>Microsecond time clock is now available on most windows compilers as well as
1190                  Unix.
1191           </td>
1192 </tr>
1193 <tr>
1194 <td>Feature</td>
1195 <td>Use of the boost::serialization library is now available with most of the
1196                  date_time classes. Classes capable of serialization are: date_generator classes,
1197                  date, days, date_period, greg_month, greg_weekday, greg_day, ptime, time_duration,
1198                  and time_period. Thanks to Bart Garst for this change.
1199           </td>
1200 </tr>
1201 <tr>
1202 <td>Feature</td>
1203 <td>Functions added to convert date and time classes to wstring. The library now
1204                  provides to_*_wstring as well as to_*_string functions for: simple, iso,
1205                  iso_extended, and sql for dates and compilers that support wstrings. Thanks to
1206                  Bart Garst for this change.
1207           </td>
1208 </tr>
1209 <tr>
1210 <td>Feature</td>
1211 <td>Period classes now handle zero length and NULL periods correctly. A NULL period
1212                  is a period with a negative length. Thanks to Frank Wolf and Bart Garst for this
1213                  change.
1214           </td>
1215 </tr>
1216 <tr>
1217 <td>Feature</td>
1218 <td>Added end_of_month function to gregorian::date to return the last day of
1219                  the current month represented by the date.  Result is undefined for
1220                  not_a_date_time or infinities.
1221           </td>
1222 </tr>
1223 <tr>
1224 <td>Bug Fix</td>
1225 <td>Removed incorrect usage of BOOST_NO_CWCHAR macro throughout library.
1226           </td>
1227 </tr>
1228 <tr>
1229 <td>Feature</td>
1230 <td>New names added for some date classes. Original names are still valid but may
1231                  some day be deprecated. Changes are:
1232             <table border="0" summary="Simple list" class="simplelist">
1233 <tr>
1234 <td>date_duration</td>
1235 <td>is now</td>
1236 <td>days</td>
1237 </tr>
1238 <tr>
1239 <td>nth_kday_of_month</td>
1240 <td>is now</td>
1241 <td>nth_day_of_the_week_in_month</td>
1242 </tr>
1243 <tr>
1244 <td>first_kday_of_month</td>
1245 <td>is now</td>
1246 <td>first_day_of_the_week_in_month</td>
1247 </tr>
1248 <tr>
1249 <td>last_kday_of_month</td>
1250 <td>is now</td>
1251 <td>last_day_of_the_week_in_month</td>
1252 </tr>
1253 <tr>
1254 <td>first_kday_after</td>
1255 <td>is now</td>
1256 <td>first_day_of_the_week_after</td>
1257 </tr>
1258 <tr>
1259 <td>first_kday_before</td>
1260 <td>is now</td>
1261 <td>first_day_of_the_week_before</td>
1262 </tr>
1263 </table>
1264           </td>
1265 </tr>
1266 <tr>
1267 <td>Feature</td>
1268 <td>Free functions for date generators added. Functions are: days_until_weekday, days_before_weekday, next_weekday, and previous_weekday.
1269             <pre class="screen">days days_until_weekday(date, greg_weekday);
1270 days days_before_weekday(date, greg_weekday);
1271 date next_weekday(date, greg_weekday);
1272 date previous_weekday(date, greg_weekday);</pre>
1273             Thanks to Bart Garst for this change.
1274           </td>
1275 </tr>
1276 <tr>
1277 <td>Feature</td>
1278 <td>New experimental duration types added for months, years, and weeks. These classes
1279                  also provide mathematical operators for use with date and time classes.  Be aware
1280                  that adding of months or years a time or date past the 28th of a month may show
1281                  non-normal mathematical properties.  This is a result of 'end-of-month'
1282                  snapping used in the calculation.  The last example below illustrates the
1283                  issue.
1284
1285             <pre class="screen">months m(12);
1286 years y(1);
1287 m == y; // true
1288 days d(7);
1289 weeks w(1);
1290 d == w; // true
1291 ptime t(...);
1292 t += months(3);
1293 date d(2004,Jan,30);
1294 d += months(1); //2004-Feb-29
1295 d -= months(1); //2004-Jan-29</pre>
1296             Input  streaming is not yet implemented for these types.
1297             Thanks to Bart Garst for this change.
1298           </td>
1299 </tr>
1300 <tr>
1301 <td>Feature</td>
1302 <td>Unifying base class for date_generators brought in to gregorian namespace. See <a class="link" href="examples.html#date_time.examples.print_holidays" title="Print Holidays">Print Holidays Example</a>.
1303           </td>
1304 </tr>
1305 <tr>
1306 <td>Feature</td>
1307 <td>Added constructors for date and ptime that allow for default construction (both)
1308                  and special values construction (ptime, both now support this). Default
1309                  constructors initialize the objects to not_a_date_time (NADT).
1310                  <pre class="screen">ptime p_nadt(not_a_date_time);
1311 ptime p_posinf(pos_infin);
1312 ptime p; // p == NADT
1313 date d;  // d == NADT</pre>
1314             Thanks to Bart Garst for this change.
1315           </td>
1316 </tr>
1317 <tr>
1318 <td>Feature</td>
1319 <td>Output streaming now supports wide stream output on compiler / standard library combinations that support wide streams. This allows code like:
1320             <pre class="screen">std::wstringstream wss;
1321 date d(2003,Aug,21);
1322 wss &lt;&lt; d;</pre>
1323             Thanks to Bart Garst for this change.
1324           </td>
1325 </tr>
1326 <tr>
1327 <td>Feature</td>
1328 <td>Input streaming for date and time types is now supported on both wide and narrow streams:
1329             <pre class="screen">date d(not_a_date_time);
1330 std::stringstream ss("2000-FEB-29");
1331 ss &gt;&gt; d; //Feb 29th, 2000
1332 std::wstringstream ws("2000-FEB-29");
1333 ws &gt;&gt; d; //Feb 29th, 2000</pre>
1334             Thanks to Bart Garst for this change.
1335           </td>
1336 </tr>
1337 <tr>
1338 <td>Bug Fix</td>
1339 <td> Fixed bug in duration_from_string() where a string formatted with
1340                   less than full amount of fractional digits created an incorrect
1341                   time_duration.  With microsecond resolution for time durations
1342                   the string "1:01:01.010" created a time duration of
1343                   01:01:01.000010 instead of 01:01:01.010000
1344           </td>
1345 </tr>
1346 <tr>
1347 <td>Bug Fix</td>
1348 <td>Fixed the special value constructor for gregorian::date and posix_time::ptime
1349                  when constructing with min_date_time or max_date_time.  The wrong value was
1350                  constructed for these.
1351           </td>
1352 </tr>
1353 </tbody>
1354 </table></div>
1355 <h4>
1356 <a name="idp181340096"></a>Changes from Boost 1.30 to 1.31 (date_time 1.01 to 1.02)</h4>
1357 <div class="informaltable"><table class="table">
1358 <colgroup>
1359 <col>
1360 <col>
1361 </colgroup>
1362 <thead><tr>
1363 <th>Type</th>
1364 <th>Description</th>
1365 </tr></thead>
1366 <tbody>
1367 <tr>
1368 <td>Bug Fix</td>
1369 <td>Build configuration updated so dll, statically, and dynamically linkable library files are now produced with MSVC compilers. See <a class="link" href="details.html#date_time.buildinfo" title="Build-Compiler Information">Build/Compiler Information</a> for more details.</td>
1370 </tr>
1371 <tr>
1372 <td>Bug Fix</td>
1373 <td>Time_duration from_string is now correctly constructed from a negative value. (ie "-0:39:00.000") Code provided by Bart Garst.</td>
1374 </tr>
1375 <tr>
1376 <td>Bug Fix</td>
1377 <td>Fixed many MSVC compiler warnings when compiled with warning level 4.</td>
1378 </tr>
1379 <tr>
1380 <td>Feature</td>
1381 <td>Added prefix decrement operator (--) for date and time iterators. See <a class="link" href="posix_time.html#date_time.posix_time.time_iterators" title="Time Iterators">Time Iterators</a>  and <a class="link" href="gregorian.html#date_time.gregorian.date_iterators" title="Date Iterators">Date Iterators</a> for more details. Code provided by Bart Garst.</td>
1382 </tr>
1383 <tr>
1384 <td>Feature</td>
1385 <td>Special_values functionality added for date_duration, time_duration and time classes. Code provided by Bart Garst.</td>
1386 </tr>
1387 <tr>
1388 <td>Bug Fix</td>
1389 <td>Fixed time_duration_traits calculation bug which was causing time duration to be limited to 32bit range even when 64 bits were available. Thanks to Joe de Guzman for tracking this down.</td>
1390 </tr>
1391 <tr>
1392 <td>Bug Fix</td>
1393 <td>Provided additional operators for duration types (eg: date_duration, time_duration). This includes dividable by integer and fixes to allow +=, -= operators. Thanks to Bart Garst for writing this code. Also, the documentation of <a class="link" href="details.html#date_time.calculations" title="Calculations">Calculations</a> has been improved.</td>
1394 </tr>
1395 <tr>
1396 <td>Bug Fix</td>
1397 <td>Added typedefs to boost::gregorian gregorian_types.hpp various date_generator function classes.</td>
1398 </tr>
1399 <tr>
1400 <td>Feature</td>
1401 <td>Added from_time_t function to convert time_t to a ptime.</td>
1402 </tr>
1403 <tr>
1404 <td>Feature</td>
1405 <td>Added a span function for combining periods. See <a class="link" href="gregorian.html#date_time.gregorian.date_period" title="Date Period">date period</a> and <a class="link" href="posix_time.html#date_time.posix_time.time_period" title="Time Period">time period</a> docs.</td>
1406 </tr>
1407 <tr>
1408 <td>Feature</td>
1409 <td>Added a function to time_duration to get the total number of seconds in a
1410                  duration truncating any fractional seconds. In addition, other resolutions
1411                  were added to allow for easy conversions. For example
1412             <pre class="screen">seconds(1).total_milliseconds() == 1000
1413 seconds(1).total_microseconds() == 1000000
1414 hours(1).total_milliseconds() == 3600*1000 //3600 sec/hour
1415 seconds(1).total_nanoseconds() == 1000000000</pre>
1416
1417            </td>
1418 </tr>
1419 <tr>
1420 <td>Feature</td>
1421 <td>Added output streaming operators for the <a class="link" href="gregorian.html#date_time.gregorian.date_algorithms" title="Date Generators/Algorithms">date generator</a> classes - partial_date, first_kday_after, first_kday_before, etc. Thanks to Bart Garst for this work.</td>
1422 </tr>
1423 <tr>
1424 <td>Feature</td>
1425 <td>Added unary- operators for durations for reversing the sign of a time duration. For example:
1426             <pre class="screen">time_duration td(5,0,0); //5 hours
1427 td = -td; //-5 hours</pre>
1428           Thanks to Bart Garst for this work.</td>
1429 </tr>
1430 <tr>
1431 <td>Feature</td>
1432 <td>Added support for parsing strings with 'month names'. Thus creating a date object from string now accepts multiple formats ("2003-10-31","2003-Oct-31", and "2003-October-31"). Thus, date d = from_simple_string("2003-Feb-27") is now allowed. A bad month name string ( from_simple_string("2003-SomeBogusMonthName-27")) will cause a bad_month exception. On most compilers the string compare is case insensitive. Thanks to Bart Garst for this work.</td>
1433 </tr>
1434 <tr>
1435 <td>Feature</td>
1436 <td>In addition to support for month names or numbers, functions have been added to create date objects from multi-ordered date strings. Ex: "January-21-2002", "2002-Jan-21", and "21-Jan-2003". See <a class="link" href="gregorian.html#date_time.gregorian.date_class" title="Date">Date Class</a> for more details.</td>
1437 </tr>
1438 <tr>
1439 <td>Bug-Fix</td>
1440 <td>Various documentation fixes. Thanks to Bart Garst for updates.</td>
1441 </tr>
1442 </tbody>
1443 </table></div>
1444 <h4>
1445 <a name="idp181374128"></a>Changes from Boost 1.29 to 1.30 (date_time 1.00 to 1.01)</h4>
1446 <p>
1447     Notice: The interface to the partial_date class (see <a class="link" href="gregorian.html#date_time.gregorian.date_algorithms" title="Date Generators/Algorithms">date_algorithms</a>) was changed. The order of construction parameters was changed which will cause some code to fail execution. This change was made to facilitate more generic local time adjustment code. Thus instead of specifying partial_date pd(Dec,25) the code needs to be changed to partial_date pd(25, Dec);
1448   </p>
1449 <div class="informaltable"><table class="table">
1450 <colgroup>
1451 <col>
1452 <col>
1453 </colgroup>
1454 <thead><tr>
1455 <th>Type</th>
1456 <th>Description</th>
1457 </tr></thead>
1458 <tbody>
1459 <tr>
1460 <td>Bug Fix</td>
1461 <td>Added new experimental feature for Daylight Savings Time calculations. This allows traits based specification of dst rules.</td>
1462 </tr>
1463 <tr>
1464 <td>Feature</td>
1465 <td>Added new interfaces to calculate julian day and modified julian day to the gregorian date class. See <a class="link" href="gregorian.html#date_time.gregorian.date_class" title="Date">boost::gregorian::date</a>.</td>
1466 </tr>
1467 <tr>
1468 <td>Feature</td>
1469 <td>Add new interface to calculate iso 8601 week number for a date. See <a class="link" href="gregorian.html#date_time.gregorian.date_class" title="Date">boost::gregorian::date</a>.</td>
1470 </tr>
1471 <tr>
1472 <td>Feature</td>
1473 <td>Add an iso 8601 time date-time format (eg: YYYYMMDDTHHHMMSS) parsing function. See <a class="link" href="posix_time.html#date_time.posix_time.ptime_class" title="Ptime">Class ptime</a> for more information.</td>
1474 </tr>
1475 <tr>
1476 <td>Feature</td>
1477 <td> Added a length function to the period template so that both date_periods and time_periods will now support this function.</td>
1478 </tr>
1479 <tr>
1480 <td>Bug Fix</td>
1481 <td>Split Jamfiles so that libs/date_time/build/Jamfile only builds library and /libs/date_time/libs/test/Jamfile which runs tests.</td>
1482 </tr>
1483 <tr>
1484 <td>Bug Fix</td>
1485 <td>Fixed many minor documentation issues.</td>
1486 </tr>
1487 <tr>
1488 <td>Bug Fix</td>
1489 <td>Removed the DATE_TIME_INLINE macro which was causing link errors. This macro is no longer needed in projects using the library.</td>
1490 </tr>
1491 <tr>
1492 <td>Bug Fix</td>
1493 <td>Added missing typedef for year_iterator to gregorian_types.hpp</td>
1494 </tr>
1495 <tr>
1496 <td>Bug Fix</td>
1497 <td>Fixed problem with gregorian ostream operators that prevented the use of wide streams.</td>
1498 </tr>
1499 <tr>
1500 <td>Bug-Fix</td>
1501 <td>Tighten error handling for dates so that date(2002, 2, 29) will throw a bad_day_of_month exception. Previously the date would be incorrectly constructed. Reported by sourceforge bug: 628054 among others.</td>
1502 </tr>
1503 </tbody>
1504 </table></div>
1505 </div>
1506 <div class="section">
1507 <div class="titlepage"><div><div><h3 class="title">
1508 <a name="date_time.acknowledgements"></a>Acknowledgements</h3></div></div></div>
1509 <p>
1510     Many people have contributed to the development of this library. In particular Hugo Duncan and Joel de Guzman for help with porting to various compilers. For initial development of concepts and design Corwin Joy and Michael Kenniston deserve special thanks. Also extra thanks to Michael for writing up the theory and tradeoffs part of the documentation. Dave Zumbro for initial inspiration and sage thoughts. Many thanks to boost reviewers and users including: William Seymour, Kjell Elster, Beman Dawes, Gary Powell, Andrew Maclean, William Kempf, Peter Dimov, Chris Little, David Moore, Darin Adler, Gennadiy Rozental, Joachim Achtzehnter, Paul Bristow, Jan Langer, Mark Rodgers, Glen Knowles, Matthew Denman, and George Heintzelman. 
1511   </p>
1512 </div>
1513 </div>
1514 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
1515 <td align="left"></td>
1516 <td align="right"><div class="copyright-footer">Copyright &#169; 2001-2005 CrystalClear Software, Inc<p>Subject to the Boost Software License, Version 1.0. (See accompanying file
1517     <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>
1518 </div></td>
1519 </tr></table>
1520 <hr>
1521 <div class="spirit-nav">
1522 <a accesskey="p" href="serialization.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../date_time.html"><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="examples.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
1523 </div>
1524 </body>
1525 </html>