Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/doc/html/date_time/details.html @ 12

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

added boost

File size: 63.1 KB
Line 
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4<title>Details</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.html" title="Chapter 3. 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%">
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="serialization.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../date_time.html"><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="examples.html"><img src="../images/next.png" alt="Next"></a>
24</div>
25<div class="section" lang="en">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="date_time.details"></a>Details</h3></div></div></div>
28<div class="toc"><dl>
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" lang="en">
40<div class="titlepage"><div><div><h4 class="title">
41<a name="date_time.calculations"></a>Calculations</h4></div></div></div>
42<p><a href="details.html#timepoints">Timepoints</a> --
43    <a href="details.html#durations">Durations</a> --
44    <a href="details.html#intervals">Intervals (Periods)</a> --
45    <a href="details.html#special_value_handling">Special Value Handling</a></p>
46<a name="timepoints"></a><h3>
47<a name="id2599873"></a>Timepoints</h3>
48<p>
49    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:
50    </p>
51<pre class="programlisting">
52      Timepoint + Duration  --&gt; Timepoint
53      Timepoint - Duration  --&gt; Timepoint
54      Timepoint - Timepoint --&gt; Duration
55    </pre>
56<p>
57    Unlike regular numeric types, the following operations are undefined:
58    </p>
59<pre class="programlisting">
60      Duration + Timepoint  --&gt; Undefined
61      Duration - Timepoint  --&gt; Undefined
62      Timepoint + Timepoint --&gt; Undefined
63    </pre>
64<a name="durations"></a><h3>
65<a name="id2599907"></a>Durations</h3>
66<p>
67    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:
68    </p>
69<pre class="programlisting">
70      Duration + Duration  --&gt; Duration
71      Duration - Duration  --&gt; Duration
72     
73      Duration * Integer   --&gt; Duration
74      Integer  * Duration  --&gt; Duration
75      Duration / Integer   --&gt; Duration  (Integer Division rules)
76    </pre>
77<a name="intervals"></a><h3>
78<a name="id2599935"></a>Intervals (Periods)</h3>
79<p>
80    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:
81    </p>
82<pre class="programlisting">
83Timeperiod intersection Timeperiod --&gt; Timeperiod
84  (null interval if no intersection)
85Timeperiod merge Timeperiod        --&gt; Timeperiod
86  (null interval if no intersection)
87Timeperiod shift Duration          --&gt; Timeperiod
88  (shift start and end by duration amount)
89    </pre>
90<p>
91    In addition, periods support various queries that calculate boolean results. The first set is caluculations with other time periods:
92    </p>
93<pre class="programlisting">
94  Timeperiod == Timeperiod           --&gt; bool
95  Timeperiod &lt; Timeperiod            --&gt; bool (true if lhs.last &lt;= rhs.begin)
96  Timeperiod intersects Timeperiod   --&gt; bool
97  Timeperiod contains Timeperiod     --&gt; bool
98  Timeperiod is_adjacent Timeperiod  --&gt; bool
99    </pre>
100<p>
101    The following calculations are performed versus the Timepoint.
102    </p>
103<pre class="programlisting">
104  Timeperiod contains Timepoint      --&gt; bool
105  Timeperiod is_before Timepoint     --&gt; bool
106  Timeperiod is_after Timepoint      --&gt; bool
107    </pre>
108<a name="special_value_handling"></a><h3>
109<a name="id2599991"></a>Special Value Handling</h3>
110<p>
111    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.
112    </p>
113<pre class="programlisting">
114  Timepoint(NADT) + Duration --&gt; Timepoint(NADT)
115  Timepoint(&#8734;) + Duration    --&gt; Timepoint(&#8734;)
116  Timepoint + Duration(&#8734;)    --&gt; Timepoint(&#8734;)
117  Timepoint - Duration(&#8734;)    --&gt; Timepoint(-&#8734;)
118    </pre>
119<p>
120    When performing operations on both positive and negative infinities, the library will produce results consistent with the following.
121    </p>
122<pre class="programlisting">
123  Timepoint(+&#8734;) + Duration(-&#8734;) --&gt; NADT
124  Duration(+&#8734;) + Duration(-&#8734;)  --&gt; NADT
125  Duration(±&#8734;) * Zero          --&gt; NADT
126 
127  Duration(&#8734;) * Integer(Not Zero) --&gt; Duration(&#8734;)
128  Duration(+&#8734;) * -Integer         --&gt; Duration(-&#8734;)
129  Duration(&#8734;) / Integer           --&gt; Duration(&#8734;)
130    </pre>
131</div>
132<div class="section" lang="en">
133<div class="titlepage"><div><div><h4 class="title">
134<a name="date_time.design_goals"></a>Design Goals</h4></div></div></div>
135<div class="informaltable"><table class="table">
136<colgroup>
137<col>
138<col>
139</colgroup>
140<thead>
141<tr>
142<th rowspan="2" valign="top">Category</th>
143<th>Description</th>
144</tr>
145<tr><th>Functions</th></tr>
146</thead>
147<tbody>
148<tr>
149<td rowspan="2" valign="top">Interfaces</td>
150<td>Provide concrete classes for manipulation of dates and times</td>
151</tr>
152<tr><td><div class="itemizedlist"><ul type="bullet">
153<li style="list-style-type: disc">date, time, date_duration, time_duration, date_period, time_period, etc</li>
154<li style="list-style-type: disc">support for infinity - positive infinity, negative infinity</li>
155<li style="list-style-type: disc">iterators over time and date ranges</li>
156<li style="list-style-type: disc">allow date and time implementations to be separate as much as possible</li>
157</ul></div></td></tr>
158<tr>
159<td rowspan="2" valign="top">Calculation</td>
160<td>Provide a basis for performing efficient time calculations </td>
161</tr>
162<tr><td><div class="itemizedlist"><ul type="bullet">
163<li style="list-style-type: disc">days between dates </li>
164<li style="list-style-type: disc">durations of times </li>
165<li style="list-style-type: disc">durations of dates and times together </li>
166</ul></div></td></tr>
167<tr>
168<td rowspan="2" valign="top">Representation Flexibility</td>
169<td>Provide the maximum possible reusability and flexibility</td>
170</tr>
171<tr><td><div class="itemizedlist"><ul type="bullet">
172<li style="list-style-type: disc">traits based customization of internal representations for size versus resolution control</li>
173<li 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>
174<li style="list-style-type: disc">Options for configuring unique calendar representations (Gregorian + others)</li>
175<li style="list-style-type: disc">the use of Julian Day number and the conversion between this and the Gregorian/Julian calendar date</li>
176<li style="list-style-type: disc">Allow for flexible adjustments including leap seconds</li>
177</ul></div></td></tr>
178<tr>
179<td rowspan="2" valign="top">Date Calculations</td>
180<td>Provide tools for date calculations</td>
181</tr>
182<tr><td><div class="itemizedlist"><ul type="bullet">
183<li style="list-style-type: disc">provide basis for calculation of complex event specs like holidays</li>
184<li style="list-style-type: disc">calendar to calendar conversions</li>
185<li style="list-style-type: disc">provide for ability to extend to new calendar systems</li>
186</ul></div></td></tr>
187<tr>
188<td rowspan="2" valign="top">Time Calculations</td>
189<td>Provide concrete classes for manipulation of time</td>
190</tr>
191<tr><td><div class="itemizedlist"><ul type="bullet">
192<li style="list-style-type: disc">provide the ability to handle cross time-zone issues</li>
193<li style="list-style-type: disc">provide adjustments for daylight savings time (summer time)</li>
194</ul></div></td></tr>
195<tr>
196<td rowspan="2" valign="top">Clock Interfaces</td>
197<td>Provide classes for retrieving time current time</td>
198</tr>
199<tr><td><div class="itemizedlist"><ul type="bullet">
200<li style="list-style-type: disc">access to a network / high resolution time sources </li>
201<li style="list-style-type: disc">retrieving the current date time information to populate classes </li>
202</ul></div></td></tr>
203<tr>
204<td rowspan="2" valign="top">I/O Interfaces</td>
205<td>Provide input and output for time including</td>
206</tr>
207<tr><td><div class="itemizedlist"><ul type="bullet">
208<li style="list-style-type: disc">multi-lingual support </li>
209<li style="list-style-type: disc">provide ISO8601 compliant time facet </li>
210<li style="list-style-type: disc">use I/O facets for different local behavior </li>
211</ul></div></td></tr>
212</tbody>
213</table></div>
214</div>
215<div class="section" lang="en">
216<div class="titlepage"><div><div><h4 class="title">
217<a name="date_time.tradeoffs"></a>Tradeoffs: Stability, Predictability, and Approximations</h4></div></div></div>
218<h2>
219<a name="id2600254"></a>
220    Unavoidable Trade-offs
221  </h2>
222<p>
223    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:
224    </p>
225<div class="itemizedlist"><ul type="bullet">
226<li style="list-style-type: disc">exact agreement with wall-clock time</li>
227<li style="list-style-type: disc">accurate math, e.g. duration calculations</li>
228<li style="list-style-type: disc">ability to handle timepoints in the future</li>
229</ul></div>
230<p>
231    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:
232  </p>
233<p>
234    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.
235  </p>
236<p>
237    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.
238  </p>
239<p>
240    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.
241  </p>
242<h2>
243<a name="id2600310"></a>
244    Stability, Predictability, and Approximations
245  </h2>
246<p>
247    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.
248  </p>
249<h3>
250<a name="id2600321"></a>
251    Stability
252  </h3>
253<p>
254    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.
255  </p>
256<p>
257    An operation on a type is stable if the result of applying the operation to a particular operand(s) does not change over time.
258  </p>
259<h3>
260<a name="id2600341"></a>
261    Predictability
262  </h3>
263<p>
264    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>.
265  </p>
266<p>
267    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>.
268  </p>
269<p>
270    If for any x, is_member( x ) returns dont_know, we say the set T is <span class="emphasis"><em>ill-defined</em></span>.
271  </p>
272<p>
273    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:
274  </p>
275<p>
276    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:
277    </p>
278<div class="itemizedlist"><ul type="bullet">
279<li style="list-style-type: disc">v = true or v = false, and</li>
280<li 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>
281<li style="list-style-type: disc">for all t &gt;= t<sub>i</sub>, is_member( x<sub>i</sub>, t ) returns v.</li>
282</ul></div>
283<p>
284    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:
285  </p>
286<p>
287    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>.
288  </p>
289<p>
290    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>.
291  </p>
292<p>
293    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).
294  </p>
295<p>
296    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.
297  </p>
298<h3>
299<a name="id2600485"></a>
300    Stability of Operations
301  </h3>
302<p>
303    Predictable types have a couple of important properties:
304    </p>
305<div class="itemizedlist"><ul type="bullet">
306<li style="list-style-type: disc">there is an order-preserving mapping from their elements onto a set of consecutive integers, and</li>
307<li style="list-style-type: disc">duration operations on their values are stable</li>
308</ul></div>
309<p>
310    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.
311  </p>
312<p>
313    Unpredictable types have exactly the opposite properties:
314    </p>
315<div class="itemizedlist"><ul type="bullet">
316<li style="list-style-type: disc">there is no order-preserving mapping from their elements onto a set of consecutive integers, and</li>
317<li style="list-style-type: disc">duration operations on their values are not stable. </li>
318</ul></div>
319<p>
320    Examples of unpredictable types are UTC timepoints and Local Time timepoints.
321  </p>
322<p>
323    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.
324  </p>
325<h3>
326<a name="id2600535"></a>
327    Approximations
328  </h3>
329<p>
330    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.
331  </p>
332<p>
333    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.
334  </p>
335<p>
336    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.
337  </p>
338</div>
339<div class="section" lang="en">
340<div class="titlepage"><div><div><h4 class="title">
341<a name="date_time.terminology"></a>Terminology</h4></div></div></div>
342<p>
343    The following are a number of terms relevant to the date-time domain.
344  </p>
345<p>
346    A taxonomy of temporal types:
347    </p>
348<div class="itemizedlist"><ul type="bullet">
349<li style="list-style-type: disc">Timepoint -- Specifier for a location in the time continuum. Similar to a number on a ruler.</li>
350<li style="list-style-type: disc">Timelength -- A duration of time unattached to any point on the time continuum.</li>
351<li style="list-style-type: disc">Timeinterval -- A duration of time attached to a specific point in the time continuum.</li>
352</ul></div>
353<p>
354    And some other terms:
355    </p>
356<div class="itemizedlist"><ul type="bullet">
357<li style="list-style-type: disc">Accuracy -- A measure of error, the difference between the reading of a clock and the true time.</li>
358<li style="list-style-type: disc">Calendar System -- A system for labeling time points with day level resolution.</li>
359<li 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>
360<li style="list-style-type: disc">Precision -- A measure of repeatability of a clock.</li>
361<li 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>
362<li 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>
363<li style="list-style-type: disc">Time System -- A system for labeling time points with higher resolution than day-level. </li>
364</ul></div>
365<p>
366    Some standard date-time terminology:
367    </p>
368<div class="itemizedlist"><ul type="bullet">
369<li style="list-style-type: disc">Epoch -- Starting time point of a calendar or clock system.</li>
370<li 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>
371<li 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>
372<li 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>
373</li>
374<li 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>
375</li>
376</ul></div>
377<p>
378    Some more experimental ones:
379    </p>
380<div class="itemizedlist"><ul type="bullet">
381<li style="list-style-type: disc">Local Time -- A time measured in a specific location of the universe.</li>
382<li 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>
383<li 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>
384</ul></div>
385<p>
386    These are design sorts of terms:
387    </p>
388<div class="itemizedlist"><ul type="bullet"><li 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>
389</div>
390<div class="section" lang="en">
391<div class="titlepage"><div><div><h4 class="title">
392<a name="date_time.references"></a>References</h4></div></div></div>
393<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>.
394  </p>
395<div class="itemizedlist"><ul type="bullet">
396<li style="list-style-type: disc"><a href="details.html#date_ref">Date References</a></li>
397<li style="list-style-type: disc"><a href="details.html#time_ref">Time References</a></li>
398<li style="list-style-type: disc"><a href="details.html#other_c_libs">Other C/C++ Libraries</a></li>
399<li style="list-style-type: disc"><a href="details.html#java_libs">JAVA Date-Time Libraries</a></li>
400<li style="list-style-type: disc"><a href="details.html#script_libs">Scripting Language Libraries</a></li>
401<li style="list-style-type: disc"><a href="details.html#related">Related Commercial and Fanciful Pages</a></li>
402<li style="list-style-type: disc"><a href="details.html#resolution">Resolution, Precision, and Accuracy</a></li>
403</ul></div>
404<a name="date_ref"></a><h3>
405<a name="id2600786"></a>Date Calendar References</h3>
406<div class="itemizedlist"><ul type="bullet">
407<li 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>
408</li>
409<li style="list-style-type: disc">
410<a href="http://emr.cs.iit.edu/home/reingold/calendar-book/second-edition/" target="_top">Calendrical Calculations</a> book by Reingold &amp; Dershowitz</li>
411<li style="list-style-type: disc"><a href="http://www.tondering.dk/claus/calendar.html" target="_top">Calendar FAQ by Claus Tøndering</a></li>
412<li style="list-style-type: disc">Calendar zone <a href="http://www.calendarzone.com" target="_top">http://www.calendarzone.com</a>
413</li>
414<li style="list-style-type: disc"><a href="http://www.w3.org/TR/xmlschema-2/#dateTime" target="_top">XML schema for date time</a></li>
415<li style="list-style-type: disc">Will Linden's <a href="http://www.ecben.net/calendar.shtml" target="_top">Calendar Links</a>
416</li>
417<li style="list-style-type: disc"><a href="http://www21.brinkster.com/lonwolve/melt/index.htm" target="_top">XMAS calendar melt</a></li>
418</ul></div>
419<a name="time_ref"></a><h3>
420<a name="id2600851"></a>Time</h3>
421<div class="itemizedlist"><ul type="bullet">
422<li style="list-style-type: disc">Martin Folwer on time patterns
423        <div class="itemizedlist"><ul type="opencircle">
424<li><a href="http://www.aw.com/cseng/titles/0-201-89542-0/apsupp/events2-1.html" target="_top">Recurring Events for Calendars</a></li>
425<li>Patterns for things that <a href="http://martinfowler.com/ap2/timeNarrative.html" target="_top">Change with time</a>
426</li>
427</ul></div>
428</li>
429<li 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>
430</li>
431<li style="list-style-type: disc">Network Time Protocol at <a href="http://www.ntp.org/" target="_top">NTP.org</a>
432</li>
433<li style="list-style-type: disc">US Navy <a href="http://tycho.usno.navy.mil/systime.html" target="_top">Systems of Time</a>
434</li>
435<li 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>
436<li style="list-style-type: disc">
437<a href="http://beta.zyprexia.com/docs/pgsql/user/datatype1130.htm" target="_top">Date-Time type PostgreSQL</a> User Guide </li>
438</ul></div>
439<a name="other_c_libs"></a><h3>
440<a name="id2600925"></a>Other C/C++ Libraries</h3>
441<div class="itemizedlist"><ul type="bullet">
442<li style="list-style-type: disc">
443<a href="http://www.cplusplus.com/ref/ctime/index.html" target="_top">ctime C</a> Standard library reference at cplusplus.com</li>
444<li style="list-style-type: disc">
445<a href="http://www.cl.cam.ac.uk/~mgk25/c-time/" target="_top">XTime C extension</a> proposal</li>
446<li style="list-style-type: disc">
447<a href="http://david.tribble.com/text/c0xcalendar.html#author-info" target="_top">Another C library extension proposal</a> by David Tribble</li>
448<li style="list-style-type: disc">
449<a href="http://cr.yp.to/libtai.html" target="_top">libTAI</a> is a C based time library</li>
450<li style="list-style-type: disc">
451<a href="http://www.twinsun.com/tz/tz-link.htm" target="_top">Time Zone Database</a> C library for managing timezones/places</li>
452<li style="list-style-type: disc">International Components for Unicode by IBM (open source)
453        <div class="itemizedlist"><ul type="opencircle">
454<li><a href="http://icu.sourceforge.net/userguide/dateCalendar.html" target="_top">Calendar Class</a></li>
455<li><a href="http://icu.sourceforge.net/userguide/dateTime.html" target="_top">Date Time Services</a></li>
456<li><a href="http://oss.software.ibm.com/userguide/dateTimezone.html" target="_top">Time Zone Class</a></li>
457<li><a href="http://oss.software.ibm.com/userguide/formatDateTime.html" target="_top">Date-Time Formatting</a></li>
458</ul></div>
459</li>
460<li 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>
461</ul></div>
462<a name="java_libs"></a><h3>
463<a name="id2601020"></a>JAVA Date &amp; Time Library Quick Reference</h3>
464<div class="itemizedlist"><ul type="bullet">
465<li 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>
466<li 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>
467<li 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>
468<li 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>
469<li 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>
470<li 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>
471<li 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>
472<li 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>
473</ul></div>
474<a name="script_libs"></a><h3>
475<a name="id2601090"></a>Scripting Language Libraries</h3>
476<div class="itemizedlist"><ul type="bullet">
477<li 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>
478</li>
479<li style="list-style-type: disc">Perl date-time
480        <div class="itemizedlist"><ul type="opencircle">
481<li><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>
482<li>
483<a href="http://search-dev.develooper.com/~stbey/Date-Calc-5.4/Calc.pod" target="_top">Date::Calc</a> at CPAN</li>
484<li>
485<a href="http://search.cpan.org/doc/MORTY/DateConvert-0.16/Convert.pm" target="_top">Date::Convert</a> calendar conversions at CPAN</li>
486</ul></div>
487</li>
488</ul></div>
489<a name="related"></a><h3>
490<a name="id2601141"></a>Related Commercial and Fanciful Pages</h3>
491<div class="itemizedlist"><ul type="bullet">
492<li style="list-style-type: disc">
493<a href="http://www.craphound.com/est/" target="_top">Eastern Standard Tribe</a> -- Cory Doctorow science fiction novel with time themes.</li>
494<li style="list-style-type: disc">
495<a href="http://www.leapsecond.com/java/gpsclock.htm" target="_top">Leapsecond.com time</a> page</li>
496<li style="list-style-type: disc"><a href="http://www.worldtimeserver.com" target="_top">World Time Server / TZ database</a></li>
497<li style="list-style-type: disc">
498<a href="http://www.longnow.org/10kclock/clock.htm" target="_top">10000 year clock</a> at Long Now Foundation</li>
499<li style="list-style-type: disc"><a href="http://www.timezonesforpcs.com" target="_top">Timezones for PCs</a></li>
500</ul></div>
501<a name="resolution"></a><h3>
502<a name="id2601193"></a>Resolution, Precision, and Accuracy</h3>
503<div class="itemizedlist"><ul type="bullet">
504<li style="list-style-type: disc">Definitions with pictures from <a href="http://metrologyforum.tm.agilent.com/specs.shtml" target="_top">Agilent Technologies</a>
505</li>
506<li style="list-style-type: disc">Definitions from <a href="http://www.solent.ac.uk/hydrography/notes/errorthe/accuracy.htm" target="_top">Southampton Institute</a>
507</li>
508</ul></div>
509</div>
510<div class="section" lang="en">
511<div class="titlepage"><div><div><h4 class="title">
512<a name="date_time.buildinfo"></a>Build-Compiler Information</h4></div></div></div>
513<p><a href="details.html#overview">Overview</a> --
514    <a href="details.html#compile_options">Compilation Options</a> --
515    <a href="details.html#portability">Compiler/Portability Notes</a> --
516    <a href="details.html#dir_structure">Directory Structure</a> --
517    <a href="details.html#other_boost_libs">Required Boost Libraries</a></p>
518<a name="overview"></a><h3>
519<a name="id2601272"></a>Overview</h3>
520<p>
521    The library has several functions that require the creation of a library file. 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.
522  </p>
523<a name="compile_options"></a><h3>
524<a name="id2601288"></a>Compilation Options</h3>
525<p>
526    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.
527  </p>
528<p>
529    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.
530  </p>
531<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>
532<p>As a convenience, <code class="computeroutput">date_time</code> has provided some <a 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 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>
533<p>Another convenience is the default constructors for <code class="computeroutput"><a href="gregorian.html#date_time.gregorian.date_class" title="Date">date</a></code>, and <code class="computeroutput"><a 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>
534<a name="portability"></a><h3>
535<a name="id2601401"></a>Compiler/Portability Notes</h3>
536<p>
537    The Boost Date-Time library has been built and tested with many compilers. 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 fully support all aspects of the library:
538    </p>
539<div class="itemizedlist"><ul type="bullet">
540<li style="list-style-type: disc">GCC 3.2 - 3.4, 4.0 on Linux</li>
541<li style="list-style-type: disc">GCC 3.3 on Darwin</li>
542<li style="list-style-type: disc">GCC 3.3 on Solaris</li>
543<li style="list-style-type: disc">GCC 3.2 (cygwin) *</li>
544<li style="list-style-type: disc">MinGW 3.2 *</li>
545<li style="list-style-type: disc">MSVC 7.1 </li>
546<li style="list-style-type: disc">Intel 8.1 Linux and Windows</li>
547</ul></div>
548<p>
549    * These compilers do not support the <code class="computeroutput">wstring/wstream</code> aspects of the <code class="computeroutput">date_time</code> library.
550  </p>
551<p>
552    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:
553    </p>
554<div class="itemizedlist"><ul type="bullet">
555<li style="list-style-type: disc">GCC 2.9x on Linux</li>
556<li style="list-style-type: disc">Borland 5.1.1 and 5.6</li>
557<li style="list-style-type: disc">MSVC 7.0</li>
558<li style="list-style-type: disc">MSVC 6 SP5 </li>
559</ul></div>
560<p>
561  Metrowerks Code Warrior 9.4 has some input I/O limitations, but is otherwise
562  fully supported.
563  </p>
564<h5>
565<a name="id2601472"></a>Visual Studio &amp; STLPort</h5>
566<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.
567  </p>
568<p>To build date_time with no wide stream/string etc, execute the following command from <code class="computeroutput">$BOOST_ROOT</code>:
569    </p>
570<pre class="screen">bjam -a "-sTOOLS=vc-7_1-stlport" "-sSTLPORT_PATH=..." \
571     "-sBUILD=&lt;define&gt;BOOST_NO_STD_WSTRING"           \
572     --stagedir=... --with-date_time stage</pre>
573<p>
574    (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)
575  </p>
576<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>:
577    </p>
578<pre class="screen">bjam -a "-sTOOLS=vc-7_1-stlport" "-sSTLPORT_PATH=..." \
579     "-sBUILD=&amp;native-wchar_t&gt;on"                     \
580     --stagedir=... --with-date_time stage</pre>
581<p>
582    (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)
583  </p>
584<a name="dir_structure"></a><h3>
585<a name="id2601583"></a>Directory Structure</h3>
586<p>
587    The directory tree has the following structure:
588    </p>
589<pre class="programlisting">/boost/date_time                    -- common headers and template code
590/boost/date_time/gregorian          -- Gregorian date system header files
591/boost/date_time/posix_time         -- Posix time system headers
592/boost/date_time/local_time         -- Local time system headers
593/libs/date_time/build               -- build files and output directory
594/libs/date_time/test                -- test battery for generic code
595/libs/date_time/test/gregorian      -- test battery for the Gregorian system
596/libs/date_time/test/posix_time     -- test battery for the posix_time system
597/libs/date_time/test/local_time     -- test battery for the local_time system
598/libs/date_time/examples/gregorian  -- example programs for dates
599/libs/date_time/examples/posix_time -- time example programs
600/libs/date_time/examples/local_time -- nifty example programs
601/libs/date_time/src/gregorian       -- cpp files for libboost_date_time
602/libs/date_time/src/posix_time      -- empty (one file, but no source code...)</pre>
603<a name="other_boost_libs"></a><h3>
604<a name="id2601617"></a>Required Boost Libraries</h3>
605<p>
606    Various parts of date-time depend on other boost libraries.  These include:
607    </p>
608<div class="itemizedlist"><ul type="bullet">
609<li style="list-style-type: disc"><a href="../../../libs/tokenizer/index.html" target="_top">boost.tokenizer</a></li>
610<li style="list-style-type: disc"><a href="../../../libs/integer/cstdint.htm" target="_top">boost.integer(cstdint)</a></li>
611<li style="list-style-type: disc"><a href="../../../libs/utility/operators.htm" target="_top">boost.operators</a></li>
612<li style="list-style-type: disc"><a href="../../../libs/conversion/lexical_cast.htm" target="_top">boost::lexical_cast </a></li>
613<li style="list-style-type: disc"><a href="../../../libs/smart_ptr/smart_ptr.htm" target="_top">boost::smart_ptr </a></li>
614<li style="list-style-type: disc"><a href="../../../libs/algorithm/string/index.html" target="_top">boost::string_algorithms </a></li>
615</ul></div>
616<p>
617    so at least these libraries need to be installed.
618  </p>
619</div>
620<div class="section" lang="en">
621<div class="titlepage"><div><div><h4 class="title">
622<a name="date_time.tests"></a>Tests</h4></div></div></div>
623<p>
624    The library provides a large number of tests in the
625    </p>
626<pre class="programlisting">
627      libs/date_time/test
628      libs/date_time/test/gregorian
629      libs/date_time/test/posix_time
630      libs/date_time/test/local_time
631    </pre>
632<p>
633    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.
634  </p>
635</div>
636<div class="section" lang="en">
637<div class="titlepage"><div><div><h4 class="title">
638<a name="date_time.changes"></a>Change History</h4></div></div></div>
639<h3>
640<a name="id2601701"></a>Changes from Boost 1.32 to 1.33 (date_time 1.03 to 1.04)</h3>
641<div class="informaltable"><table class="table">
642<colgroup>
643<col>
644<col>
645</colgroup>
646<thead><tr>
647<th>Type</th>
648<th>Description</th>
649</tr></thead>
650<tbody>
651<tr>
652<td>Bug Fix</td>
653<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.
654          </td>
655</tr>
656<tr>
657<td>Bug Fix</td>
658<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.
659          </td>
660</tr>
661<tr>
662<td>Feature</td>
663<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.
664          </td>
665</tr>
666<tr>
667<td>Feature</td>
668<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.
669          </td>
670</tr>
671<tr>
672<td>Bug Fix</td>
673<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.
674          </td>
675</tr>
676<tr>
677<td>Bug Fix</td>
678<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.
679          </td>
680</tr>
681<tr>
682<td>Bug Fix</td>
683<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()).
684          </td>
685</tr>
686<tr>
687<td>Bug Fix</td>
688<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').
689          </td>
690</tr>
691<tr>
692<td>Feature</td>
693<td>Major new features related to management of local times.
694                 This includes the introduction of a series of new classes to
695                 represent time zones and local times (see <a href="local_time.html" title="Local Time">Date Time Local Time</a> for complete details).
696          </td>
697</tr>
698<tr>
699<td>Feature</td>
700<td>Input and output facets have been re-written to support format-based
701            redefinition of formats (see <a href="date_time_io.html" title="Date Time Input/Output">Date Time IO</a> for complete details).
702          </td>
703</tr>
704<tr>
705<td>Feature</td>
706<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.
707          </td>
708</tr>
709<tr>
710<td>Feature</td>
711<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 href="posix_time.html#ptime_from_clock">here</a>).
712          </td>
713</tr>
714<tr>
715<td>Feature</td>
716<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.
717          </td>
718</tr>
719<tr>
720<td>Feature</td>
721<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 href="posix_time.html#ptime_from_clock">here</a>).
722          </td>
723</tr>
724<tr>
725<td>Feature</td>
726<td>Date-time now uses reentrant POSIX functions on those platforms that
727                 support them when BOOST_HAS_THREADS is defined.
728          </td>
729</tr>
730<tr>
731<td>Bug Fix</td>
732<td>Fixed a bug in serialization code where special values
733                (not-a-date-time, infinities, etc) for
734                ptime, time_duration would not read back correctly from an archive. 
735                The output serialization code wrote subfields such
736                as time_duration.seconds() which are invalid for special values and
737                thus undefined values.  Thus when read back the values could cause
738                strange behavior including execeptions on construction.
739          </td>
740</tr>
741<tr>
742<td>Bug Fix</td>
743<td>Fixed multiple warnings generated with various platforms/compilers.
744          </td>
745</tr>
746<tr>
747<td>Bug Fix</td>
748<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").
749          </td>
750</tr>
751<tr>
752<td>Bug Fix</td>
753<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).
754          </td>
755</tr>
756<tr>
757<td>Bug Fix</td>
758<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:
759            <pre class="screen">template&lt;class archive_type, class temporal_type&gt;
760void save_to(archive_type&amp; ar,
761             const temporal_type&amp; tt)
762{
763  ar &lt;&lt; tt;
764}</pre>
765</td>
766</tr>
767<tr>
768<td>Bug Fix</td>
769<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.
770          </td>
771</tr>
772<tr>
773<td>Bug Fix</td>
774<td>Templatized formatters in the legacy IO system to accept char type. Also removed calls to <code class="computeroutput">boost::lexical_cast</code>.
775          </td>
776</tr>
777</tbody>
778</table></div>
779<h3>
780<a name="id2602138"></a>Changes from Boost 1.31 to 1.32 (date_time 1.02 to 1.03)</h3>
781<div class="informaltable"><table class="table">
782<colgroup>
783<col>
784<col>
785</colgroup>
786<thead><tr>
787<th>Type</th>
788<th>Description</th>
789</tr></thead>
790<tbody>
791<tr>
792<td>Bug Fix</td>
793<td>Snap to end of month behavior corrected for year_functor. Previously, starting
794                 from 2000-Feb-28 (leap year and not end of month) and iterating through the next
795                 leap year would result in 2004-Feb-29 instead of 2004-Feb-28. This behavior has
796                 been corrected to produce the correct result of 2004-Feb-28. Thanks to Bart Garst
797                 for this change.
798          </td>
799</tr>
800<tr>
801<td>Feature</td>
802<td>Free function for creating a ptime object from a FILETIME struct. This function
803                 is only available on platforms that define BOOST_HAS_FTIME.
804          </td>
805</tr>
806<tr>
807<td>Feature</td>
808<td>Microsecond time clock is now available on most windows compilers as well as
809                 Unix.
810          </td>
811</tr>
812<tr>
813<td>Feature</td>
814<td>Use of the boost::serialization library is now available with most of the
815                 date_time classes. Classes capable of serialization are: date_generator classes,
816                 date, days, date_period, greg_month, greg_weekday, greg_day, ptime, time_duration,
817                 and time_period. Thanks to Bart Garst for this change.
818          </td>
819</tr>
820<tr>
821<td>Feature</td>
822<td>Functions added to convert date and time classes to wstring. The library now
823                 provides to_*_wstring as well as to_*_string functions for: simple, iso,
824                 iso_extended, and sql for dates and compilers that support wstrings. Thanks to
825                 Bart Garst for this change.
826          </td>
827</tr>
828<tr>
829<td>Feature</td>
830<td>Period classes now handle zero length and NULL periods correctly. A NULL period
831                 is a period with a negative length. Thanks to Frank Wolf and Bart Garst for this
832                 change.
833          </td>
834</tr>
835<tr>
836<td>Feature</td>
837<td>Added end_of_month function to gregorian::date to return the last day of
838                 the current month represented by the date.  Result is undefined for
839                 not_a_date_time or infinities.
840          </td>
841</tr>
842<tr>
843<td>Bug Fix</td>
844<td>Removed incorrect usage of BOOST_NO_CWCHAR macro throughout library.
845          </td>
846</tr>
847<tr>
848<td>Feature</td>
849<td>New names added for some date classes. Original names are still valid but may
850                 some day be deprecated. Changes are:
851            <table class="simplelist" border="0" summary="Simple list">
852<tr>
853<td>date_duration</td>
854<td>is now</td>
855<td>days</td>
856</tr>
857<tr>
858<td>nth_kday_of_month</td>
859<td>is now</td>
860<td>nth_day_of_the_week_in_month</td>
861</tr>
862<tr>
863<td>first_kday_of_month</td>
864<td>is now</td>
865<td>first_day_of_the_week_in_month</td>
866</tr>
867<tr>
868<td>last_kday_of_month</td>
869<td>is now</td>
870<td>last_day_of_the_week_in_month</td>
871</tr>
872<tr>
873<td>first_kday_after</td>
874<td>is now</td>
875<td>first_day_of_the_week_after</td>
876</tr>
877<tr>
878<td>first_kday_before</td>
879<td>is now</td>
880<td>first_day_of_the_week_before</td>
881</tr>
882</table>
883</td>
884</tr>
885<tr>
886<td>Feature</td>
887<td>Free functions for date generators added. Functions are: days_until_weekday, days_before_weekday, next_weekday, and previous_weekday.
888            <pre class="screen">days days_until_weekday(date, greg_weekday);
889days days_before_weekday(date, greg_weekday);
890date next_weekday(date, greg_weekday);
891date previous_weekday(date, greg_weekday);</pre>
892            Thanks to Bart Garst for this change.
893          </td>
894</tr>
895<tr>
896<td>Feature</td>
897<td>New experimental duration types added for months, years, and weeks. These classes
898                 also provide mathematical operators for use with date and time classes.  Be aware
899                 that adding of months or years a time or date past the 28th of a month may show
900                 non-normal mathematical properties.  This is a result of 'end-of-month'
901                 snapping used in the calculation.  The last example below illustrates the   
902                 issue. 
903           
904            <pre class="screen">months m(12);
905years y(1);
906m == y; // true
907days d(7);
908weeks w(1);
909d == w; // true
910ptime t(...);
911t += months(3);
912date d(2004,Jan,30);
913d += months(1); //2004-Feb-29
914d -= months(1); //2004-Jan-29</pre>
915            Input  streaming is not yet implemented for these types.             
916            Thanks to Bart Garst for this change.
917          </td>
918</tr>
919<tr>
920<td>Feature</td>
921<td>Unifying base class for date_generators brought in to gregorian namespace. See <a href="examples.html#date_time.examples.print_holidays" title="Print Holidays">Print Holidays Example</a>.
922          </td>
923</tr>
924<tr>
925<td>Feature</td>
926<td>Added constructors for date and ptime that allow for default construction (both)
927                 and special values construction (ptime, both now support this). Default
928                 constructors initialize the objects to not_a_date_time (NADT).
929                 <pre class="screen">ptime p_nadt(not_a_date_time);
930ptime p_posinf(pos_infin);
931ptime p; // p == NADT
932date d;  // d == NADT</pre>
933            Thanks to Bart Garst for this change.
934          </td>
935</tr>
936<tr>
937<td>Feature</td>
938<td>Output streaming now supports wide stream output on compiler / standard library combinations that support wide streams. This allows code like:
939            <pre class="screen">std::wstringstream wss;
940date d(2003,Aug,21);
941wss &lt;&lt; d;</pre>
942            Thanks to Bart Garst for this change.
943          </td>
944</tr>
945<tr>
946<td>Feature</td>
947<td>Input streaming for date and time types is now supported on both wide and narrow streams:
948            <pre class="screen">date d(not_a_date_time);
949std::stringstream ss("2000-FEB-29");
950ss &gt;&gt; d; //Feb 29th, 2000
951std::wstringstream ws("2000-FEB-29");
952ws &gt;&gt; d; //Feb 29th, 2000</pre>
953            Thanks to Bart Garst for this change.
954          </td>
955</tr>
956<tr>
957<td>Bug Fix</td>
958<td> Fixed bug in duration_from_string() where a string formatted with
959                  less than full amount of fractional digits created an incorrect
960                  time_duration.  With microsecond resolution for time durations
961                  the string "1:01:01.010" created a time duration of
962                  01:01:01.000010 instead of 01:01:01.010000
963          </td>
964</tr>
965<tr>
966<td>Bug Fix</td>
967<td>Fixed the special value constructor for gregorian::date and posix_time::ptime
968                 when constructing with min_date_time or max_date_time.  The wrong value was
969                 constructed for these.
970          </td>
971</tr>
972</tbody>
973</table></div>
974<h3>
975<a name="id2602430"></a>Changes from Boost 1.30 to 1.31 (date_time 1.01 to 1.02)</h3>
976<div class="informaltable"><table class="table">
977<colgroup>
978<col>
979<col>
980</colgroup>
981<thead><tr>
982<th>Type</th>
983<th>Description</th>
984</tr></thead>
985<tbody>
986<tr>
987<td>Bug Fix</td>
988<td>Build configuration updated so dll, statically, and dynamically linkable library files are now produced with MSVC compilers. See <a href="details.html#date_time.buildinfo" title="Build-Compiler Information">Build/Compiler Information</a> for more details.</td>
989</tr>
990<tr>
991<td>Bug Fix</td>
992<td>Time_duration from_string is now correctly constructed from a negative value. (ie "-0:39:00.000") Code provided by Bart Garst.</td>
993</tr>
994<tr>
995<td>Bug Fix</td>
996<td>Fixed many MSVC compiler warnings when compiled with warning level 4.</td>
997</tr>
998<tr>
999<td>Feature</td>
1000<td>Added prefix decrement operator (--) for date and time iterators. See <a href="posix_time.html#date_time.posix_time.time_iterators" title="Time Iterators">Time Iterators</a>  and <a href="gregorian.html#date_time.gregorian.date_iterators" title="Date Iterators">Date Iterators</a> for more details. Code provided by Bart Garst.</td>
1001</tr>
1002<tr>
1003<td>Feature</td>
1004<td>Special_values functionality added for date_duration, time_duration and time classes. Code provided by Bart Garst.</td>
1005</tr>
1006<tr>
1007<td>Bug Fix</td>
1008<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>
1009</tr>
1010<tr>
1011<td>Bug Fix</td>
1012<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 href="details.html#date_time.calculations" title="Calculations">Calculations</a> has been improved.</td>
1013</tr>
1014<tr>
1015<td>Bug Fix</td>
1016<td>Added typedefs to boost::gregorian gregorian_types.hpp various date_generator function classes.</td>
1017</tr>
1018<tr>
1019<td>Feature</td>
1020<td>Added from_time_t function to convert time_t to a ptime.</td>
1021</tr>
1022<tr>
1023<td>Feature</td>
1024<td>Added a span function for combining periods. See <a href="gregorian.html#date_time.gregorian.date_period" title="Date Period">date period</a> and <a href="posix_time.html#date_time.posix_time.time_period" title="Time Period">time period</a> docs.</td>
1025</tr>
1026<tr>
1027<td>Feature</td>
1028<td>Added a function to time_duration to get the total number of seconds in a
1029                 duration truncating any fractional seconds. In addition, other resolutions
1030                 were added to allow for easy conversions. For example
1031            <pre class="screen">seconds(1).total_milliseconds() == 1000
1032seconds(1).total_microseconds() == 1000000
1033hours(1).total_milliseconds() == 3600*1000 //3600 sec/hour
1034seconds(1).total_nanoseconds() == 1000000000</pre>
1035</td>
1036</tr>
1037<tr>
1038<td>Feature</td>
1039<td>Added output streaming operators for the <a 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>
1040</tr>
1041<tr>
1042<td>Feature</td>
1043<td>Added unary- operators for durations for reversing the sign of a time duration. For example:
1044            <pre class="screen">time_duration td(5,0,0); //5 hours
1045td = -td; //-5 hours</pre>
1046          Thanks to Bart Garst for this work.</td>
1047</tr>
1048<tr>
1049<td>Feature</td>
1050<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>
1051</tr>
1052<tr>
1053<td>Feature</td>
1054<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 href="gregorian.html#date_time.gregorian.date_class" title="Date">Date Class</a> for more details.</td>
1055</tr>
1056<tr>
1057<td>Bug-Fix</td>
1058<td>Various documentation fixes. Thanks to Bart Garst for updates.</td>
1059</tr>
1060</tbody>
1061</table></div>
1062<h3>
1063<a name="id2602658"></a>Changes from Boost 1.29 to 1.30 (date_time 1.00 to 1.01)</h3>
1064<p>
1065    Notice: The interface to the partial_date class (see <a 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);
1066  </p>
1067<div class="informaltable"><table class="table">
1068<colgroup>
1069<col>
1070<col>
1071</colgroup>
1072<thead><tr>
1073<th>Type</th>
1074<th>Description</th>
1075</tr></thead>
1076<tbody>
1077<tr>
1078<td>Bug Fix</td>
1079<td>Added new experimental feature for Daylight Savings Time calculations. This allows traits based specification of dst rules.</td>
1080</tr>
1081<tr>
1082<td>Feature</td>
1083<td>Added new interfaces to calculate julian day and modified julian day to the gregorian date class. See <a href="gregorian.html#date_time.gregorian.date_class" title="Date">boost::gregorian::date</a>.</td>
1084</tr>
1085<tr>
1086<td>Feature</td>
1087<td>Add new interface to calculate iso 8601 week number for a date. See <a href="gregorian.html#date_time.gregorian.date_class" title="Date">boost::gregorian::date</a>.</td>
1088</tr>
1089<tr>
1090<td>Feature</td>
1091<td>Add an iso 8601 time date-time format (eg: YYYYMMDDTHHHMMSS) parsing function. See <a href="posix_time.html#date_time.posix_time.ptime_class" title="Ptime">Class ptime</a> for more information.</td>
1092</tr>
1093<tr>
1094<td>Feature</td>
1095<td> Added a length function to the period template so that both date_periods and time_periods will now support this function.</td>
1096</tr>
1097<tr>
1098<td>Bug Fix</td>
1099<td>Split Jamfiles so that libs/date_time/build/Jamfile only builds library and /libs/date_time/libs/test/Jamfile which runs tests.</td>
1100</tr>
1101<tr>
1102<td>Bug Fix</td>
1103<td>Fixed many minor documentation issues.</td>
1104</tr>
1105<tr>
1106<td>Bug Fix</td>
1107<td>Removed the DATE_TIME_INLINE macro which was causing link errors. This macro is no longer needed in projects using the library.</td>
1108</tr>
1109<tr>
1110<td>Bug Fix</td>
1111<td>Added missing typedef for year_iterator to gregorian_types.hpp</td>
1112</tr>
1113<tr>
1114<td>Bug Fix</td>
1115<td>Fixed problem with gregorian ostream operators that prevented the use of wide streams.</td>
1116</tr>
1117<tr>
1118<td>Bug-Fix</td>
1119<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>
1120</tr>
1121</tbody>
1122</table></div>
1123</div>
1124<div class="section" lang="en">
1125<div class="titlepage"><div><div><h4 class="title">
1126<a name="date_time.acknowledgements"></a>Acknowledgements</h4></div></div></div>
1127<p>
1128    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.
1129  </p>
1130</div>
1131</div>
1132<table width="100%"><tr>
1133<td align="left"></td>
1134<td align="right"><small>Copyright © 2001-2005 CrystalClear Software, Inc</small></td>
1135</tr></table>
1136<hr>
1137<div class="spirit-nav">
1138<a accesskey="p" href="serialization.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../date_time.html"><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="examples.html"><img src="../images/next.png" alt="Next"></a>
1139</div>
1140</body>
1141</html>
Note: See TracBrowser for help on using the repository browser.