1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5<title>Details</title> 6<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css"> 7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 8<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> 9<link rel="up" href="../date_time.html" title="Chapter 13. Boost.Date_Time"> 10<link rel="prev" href="serialization.html" title="Serialization"> 11<link rel="next" href="examples.html" title="Examples"> 12</head> 13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 14<table cellpadding="2" width="100%"><tr> 15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td> 16<td align="center"><a href="../../../index.html">Home</a></td> 17<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td> 18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 20<td align="center"><a href="../../../more/index.htm">More</a></td> 21</tr></table> 22<hr> 23<div class="spirit-nav"> 24<a accesskey="p" href="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> 25</div> 26<div class="section"> 27<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 28<a name="date_time.details"></a>Details</h2></div></div></div> 29<div class="toc"><dl class="toc"> 30<dt><span class="section"><a href="details.html#date_time.calculations">Calculations</a></span></dt> 31<dt><span class="section"><a href="details.html#date_time.design_goals">Design Goals</a></span></dt> 32<dt><span class="section"><a href="details.html#date_time.tradeoffs">Tradeoffs: Stability, Predictability, and Approximations</a></span></dt> 33<dt><span class="section"><a href="details.html#date_time.terminology">Terminology</a></span></dt> 34<dt><span class="section"><a href="details.html#date_time.references">References</a></span></dt> 35<dt><span class="section"><a href="details.html#date_time.buildinfo">Build-Compiler Information</a></span></dt> 36<dt><span class="section"><a href="details.html#date_time.tests">Tests</a></span></dt> 37<dt><span class="section"><a href="details.html#date_time.changes">Change History</a></span></dt> 38<dt><span class="section"><a href="details.html#date_time.acknowledgements">Acknowledgements</a></span></dt> 39</dl></div> 40<div class="section"> 41<div class="titlepage"><div><div><h3 class="title"> 42<a name="date_time.calculations"></a>Calculations</h3></div></div></div> 43<p> 44 <a class="link" href="details.html#timepoints">Timepoints</a> -- 45 <a class="link" href="details.html#durations">Durations</a> -- 46 <a class="link" href="details.html#intervals">Intervals (Periods)</a> -- 47 <a class="link" href="details.html#special_value_handling">Special Value Handling</a> 48 </p> 49<a name="timepoints"></a><h4> 50<a name="id-1.3.14.13.2.4"></a>Timepoints</h4> 51<p> 52 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: 53 </p> 54<pre class="programlisting"> 55 Timepoint + Duration --> Timepoint 56 Timepoint - Duration --> Timepoint 57 Timepoint - Timepoint --> Duration 58 </pre> 59<p> 60 Unlike regular numeric types, the following operations are undefined: 61 </p> 62<pre class="programlisting"> 63 Duration + Timepoint --> Undefined 64 Duration - Timepoint --> Undefined 65 Timepoint + Timepoint --> Undefined 66 </pre> 67<p> 68 </p> 69<a name="durations"></a><h4> 70<a name="id-1.3.14.13.2.7"></a>Durations</h4> 71<p> 72 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: 73 </p> 74<pre class="programlisting"> 75 Duration + Duration --> Duration 76 Duration - Duration --> Duration 77 78 Duration * Integer --> Duration 79 Integer * Duration --> Duration 80 Duration / Integer --> Duration (Integer Division rules) 81 </pre> 82<p> 83 </p> 84<a name="intervals"></a><h4> 85<a name="id-1.3.14.13.2.10"></a>Intervals (Periods)</h4> 86<p> 87 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: 88 </p> 89<pre class="programlisting"> 90Timeperiod intersection Timeperiod --> Timeperiod 91 (null interval if no intersection) 92Timeperiod merge Timeperiod --> Timeperiod 93 (null interval if no intersection) 94Timeperiod shift Duration --> Timeperiod 95 (shift start and end by duration amount) 96 </pre> 97<p> 98 In addition, periods support various queries that calculate boolean results. The first set is caluculations with other time periods: 99 </p> 100<pre class="programlisting"> 101 Timeperiod == Timeperiod --> bool 102 Timeperiod < Timeperiod --> bool (true if lhs.last <= rhs.begin) 103 Timeperiod intersects Timeperiod --> bool 104 Timeperiod contains Timeperiod --> bool 105 Timeperiod is_adjacent Timeperiod --> bool 106 </pre> 107<p> 108 The following calculations are performed versus the Timepoint. 109 </p> 110<pre class="programlisting"> 111 Timeperiod contains Timepoint --> bool 112 Timeperiod is_before Timepoint --> bool 113 Timeperiod is_after Timepoint --> bool 114 </pre> 115<p> 116 </p> 117<a name="special_value_handling"></a><h4> 118<a name="id-1.3.14.13.2.13"></a>Special Value Handling</h4> 119<p> 120 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. 121 </p> 122<pre class="programlisting"> 123 Timepoint(NADT) + Duration --> Timepoint(NADT) 124 Timepoint(∞) + Duration --> Timepoint(∞) 125 Timepoint + Duration(∞) --> Timepoint(∞) 126 Timepoint - Duration(∞) --> Timepoint(-∞) 127 </pre> 128<p> 129 When performing operations on both positive and negative infinities, the library will produce results consistent with the following. 130 </p> 131<pre class="programlisting"> 132 Timepoint(+∞) + Duration(-∞) --> NADT 133 Duration(+∞) + Duration(-∞) --> NADT 134 Duration(±∞) * Zero --> NADT 135 136 Duration(∞) * Integer(Not Zero) --> Duration(∞) 137 Duration(+∞) * -Integer --> Duration(-∞) 138 Duration(∞) / Integer --> Duration(∞) 139 </pre> 140<p> 141 </p> 142</div> 143<div class="section"> 144<div class="titlepage"><div><div><h3 class="title"> 145<a name="date_time.design_goals"></a>Design Goals</h3></div></div></div> 146<div class="informaltable"><table class="table"> 147<colgroup> 148<col> 149<col> 150</colgroup> 151<thead> 152<tr> 153<th rowspan="2" valign="top">Category</th> 154<th>Description</th> 155</tr> 156<tr><th>Functions</th></tr> 157</thead> 158<tbody> 159<tr> 160<td rowspan="2" valign="top">Interfaces</td> 161<td>Provide concrete classes for manipulation of dates and times</td> 162</tr> 163<tr><td> 164 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 165<li class="listitem" style="list-style-type: disc">date, time, date_duration, time_duration, date_period, time_period, etc</li> 166<li class="listitem" style="list-style-type: disc">support for infinity - positive infinity, negative infinity</li> 167<li class="listitem" style="list-style-type: disc">iterators over time and date ranges</li> 168<li class="listitem" style="list-style-type: disc">allow date and time implementations to be separate as much as possible</li> 169</ul></div> 170 </td></tr> 171<tr> 172<td rowspan="2" valign="top">Calculation</td> 173<td>Provide a basis for performing efficient time calculations </td> 174</tr> 175<tr><td> 176 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 177<li class="listitem" style="list-style-type: disc">days between dates </li> 178<li class="listitem" style="list-style-type: disc">durations of times </li> 179<li class="listitem" style="list-style-type: disc">durations of dates and times together </li> 180</ul></div> 181 </td></tr> 182<tr> 183<td rowspan="2" valign="top">Representation Flexibility</td> 184<td>Provide the maximum possible reusability and flexibility</td> 185</tr> 186<tr><td> 187 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 188<li class="listitem" style="list-style-type: disc">traits based customization of internal representations for size versus resolution control</li> 189<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> 190<li class="listitem" style="list-style-type: disc">Options for configuring unique calendar representations (Gregorian + others)</li> 191<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> 192<li class="listitem" style="list-style-type: disc">Allow for flexible adjustments including leap seconds</li> 193</ul></div> 194 </td></tr> 195<tr> 196<td rowspan="2" valign="top">Date Calculations</td> 197<td>Provide tools for date calculations</td> 198</tr> 199<tr><td> 200 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 201<li class="listitem" style="list-style-type: disc">provide basis for calculation of complex event specs like holidays</li> 202<li class="listitem" style="list-style-type: disc">calendar to calendar conversions</li> 203<li class="listitem" style="list-style-type: disc">provide for ability to extend to new calendar systems</li> 204</ul></div> 205 </td></tr> 206<tr> 207<td rowspan="2" valign="top">Time Calculations</td> 208<td>Provide concrete classes for manipulation of time</td> 209</tr> 210<tr><td> 211 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 212<li class="listitem" style="list-style-type: disc">provide the ability to handle cross time-zone issues</li> 213<li class="listitem" style="list-style-type: disc">provide adjustments for daylight savings time (summer time)</li> 214</ul></div> 215 </td></tr> 216<tr> 217<td rowspan="2" valign="top">Clock Interfaces</td> 218<td>Provide classes for retrieving time current time</td> 219</tr> 220<tr><td> 221 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 222<li class="listitem" style="list-style-type: disc">access to a network / high resolution time sources </li> 223<li class="listitem" style="list-style-type: disc">retrieving the current date time information to populate classes </li> 224</ul></div> 225 </td></tr> 226<tr> 227<td rowspan="2" valign="top">I/O Interfaces</td> 228<td>Provide input and output for time including</td> 229</tr> 230<tr><td> 231 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 232<li class="listitem" style="list-style-type: disc">multi-lingual support </li> 233<li class="listitem" style="list-style-type: disc">provide ISO8601 compliant time facet </li> 234<li class="listitem" style="list-style-type: disc">use I/O facets for different local behavior </li> 235</ul></div> 236 </td></tr> 237</tbody> 238</table></div> 239</div> 240<div class="section"> 241<div class="titlepage"><div><div><h3 class="title"> 242<a name="date_time.tradeoffs"></a>Tradeoffs: Stability, Predictability, and Approximations</h3></div></div></div> 243<h3> 244<a name="id-1.3.14.13.4.2"></a> 245 Unavoidable Trade-offs 246 </h3> 247<p> 248 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: 249 </p> 250<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 251<li class="listitem" style="list-style-type: disc">exact agreement with wall-clock time</li> 252<li class="listitem" style="list-style-type: disc">accurate math, e.g. duration calculations</li> 253<li class="listitem" style="list-style-type: disc">ability to handle timepoints in the future</li> 254</ul></div> 255<p> 256 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: 257 </p> 258<p> 259 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. 260 </p> 261<p> 262 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. 263 </p> 264<p> 265 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. 266 </p> 267<h3> 268<a name="id-1.3.14.13.4.7"></a> 269 Stability, Predictability, and Approximations 270 </h3> 271<p> 272 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. 273 </p> 274<h4> 275<a name="id-1.3.14.13.4.9"></a> 276 Stability 277 </h4> 278<p> 279 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. 280 </p> 281<p> 282 An operation on a type is stable if the result of applying the operation to a particular operand(s) does not change over time. 283 </p> 284<h4> 285<a name="id-1.3.14.13.4.12"></a> 286 Predictability 287 </h4> 288<p> 289 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>. 290 </p> 291<p> 292 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>. 293 </p> 294<p> 295 If for any x, is_member( x ) returns dont_know, we say the set T is <span class="emphasis"><em>ill-defined</em></span>. 296 </p> 297<p> 298 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: 299 </p> 300<p> 301 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: 302 </p> 303<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 304<li class="listitem" style="list-style-type: disc">v = true or v = false, and</li> 305<li class="listitem" style="list-style-type: disc">for all t < t<sub>i</sub>, is_member( x<sub>i</sub>, t ) returns dont_know, and</li> 306<li class="listitem" style="list-style-type: disc">for all t >= t<sub>i</sub>, is_member( x<sub>i</sub>, t ) returns v.</li> 307</ul></div> 308<p> 309 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: 310 </p> 311<p> 312 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>. 313 </p> 314<p> 315 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>. 316 </p> 317<p> 318 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). 319 </p> 320<p> 321 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. 322 </p> 323<h4> 324<a name="id-1.3.14.13.4.22"></a> 325 Stability of Operations 326 </h4> 327<p> 328 Predictable types have a couple of important properties: 329 </p> 330<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 331<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> 332<li class="listitem" style="list-style-type: disc">duration operations on their values are stable</li> 333</ul></div> 334<p> 335 </p> 336<p> 337 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. 338 </p> 339<p> 340 Unpredictable types have exactly the opposite properties: 341 </p> 342<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 343<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> 344<li class="listitem" style="list-style-type: disc">duration operations on their values are not stable. </li> 345</ul></div> 346<p> 347 </p> 348<p> 349 Examples of unpredictable types are UTC timepoints and Local Time timepoints. 350 </p> 351<p> 352 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. 353 </p> 354<h4> 355<a name="id-1.3.14.13.4.28"></a> 356 Approximations 357 </h4> 358<p> 359 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. 360 </p> 361<p> 362 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. 363 </p> 364<p> 365 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. 366 </p> 367</div> 368<div class="section"> 369<div class="titlepage"><div><div><h3 class="title"> 370<a name="date_time.terminology"></a>Terminology</h3></div></div></div> 371<p> 372 The following are a number of terms relevant to the date-time domain. 373 </p> 374<p> 375 A taxonomy of temporal types: 376 </p> 377<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 378<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> 379<li class="listitem" style="list-style-type: disc">Timelength -- A duration of time unattached to any point on the time continuum.</li> 380<li class="listitem" style="list-style-type: disc">Timeinterval -- A duration of time attached to a specific point in the time continuum.</li> 381</ul></div> 382<p> 383 </p> 384<p> 385 And some other terms: 386 </p> 387<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 388<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> 389<li class="listitem" style="list-style-type: disc">Calendar System -- A system for labeling time points with day level resolution.</li> 390<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> 391<li class="listitem" style="list-style-type: disc">Precision -- A measure of repeatability of a clock.</li> 392<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> 393<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> 394<li class="listitem" style="list-style-type: disc">Time System -- A system for labeling time points with higher resolution than day-level. </li> 395</ul></div> 396<p> 397 </p> 398<p> 399 Some standard date-time terminology: 400 </p> 401<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 402<li class="listitem" style="list-style-type: disc">Epoch -- Starting time point of a calendar or clock system.</li> 403<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> 404<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> 405<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> 406</li> 407<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> 408</li> 409</ul></div> 410<p> 411 </p> 412<p> 413 Some more experimental ones: 414 </p> 415<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 416<li class="listitem" style="list-style-type: disc">Local Time -- A time measured in a specific location of the universe.</li> 417<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> 418<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> 419</ul></div> 420<p> 421 </p> 422<p> 423 These are design sorts of terms: 424 </p> 425<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> 426<p> 427 </p> 428</div> 429<div class="section"> 430<div class="titlepage"><div><div><h3 class="title"> 431<a name="date_time.references"></a>References</h3></div></div></div> 432<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>. 433 </p> 434<p> 435 </p> 436<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 437<li class="listitem" style="list-style-type: disc"><a class="link" href="details.html#date_ref">Date References</a></li> 438<li class="listitem" style="list-style-type: disc"><a class="link" href="details.html#time_ref">Time References</a></li> 439<li class="listitem" style="list-style-type: disc"><a class="link" href="details.html#other_c_libs">Other C/C++ Libraries</a></li> 440<li class="listitem" style="list-style-type: disc"><a class="link" href="details.html#java_libs">JAVA Date-Time Libraries</a></li> 441<li class="listitem" style="list-style-type: disc"><a class="link" href="details.html#script_libs">Scripting Language Libraries</a></li> 442<li class="listitem" style="list-style-type: disc"><a class="link" href="details.html#related">Related Commercial and Fanciful Pages</a></li> 443<li class="listitem" style="list-style-type: disc"><a class="link" href="details.html#resolution">Resolution, Precision, and Accuracy</a></li> 444</ul></div> 445<p> 446 </p> 447<a name="date_ref"></a><h4> 448<a name="id-1.3.14.13.6.5"></a>Date Calendar References</h4> 449<p> 450 </p> 451<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 452<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> 453</li> 454<li class="listitem" style="list-style-type: disc"> 455<a href="http://emr.cs.iit.edu/home/reingold/calendar-book/second-edition/" target="_top">Calendrical Calculations</a> book by Reingold & Dershowitz</li> 456<li class="listitem" style="list-style-type: disc"><a href="http://www.tondering.dk/claus/calendar.html" target="_top">Calendar FAQ by Claus Tøndering</a></li> 457<li class="listitem" style="list-style-type: disc">Calendar zone <a href="http://www.calendarzone.com" target="_top">http://www.calendarzone.com</a> 458</li> 459<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> 460<li class="listitem" style="list-style-type: disc">Will Linden's <a href="http://www.ecben.net/calendar.shtml" target="_top">Calendar Links</a> 461</li> 462<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> 463</ul></div> 464<p> 465 </p> 466<a name="time_ref"></a><h4> 467<a name="id-1.3.14.13.6.8"></a>Time</h4> 468<p> 469 </p> 470<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 471<li class="listitem" style="list-style-type: disc">Martin Folwer on time patterns 472 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: opencircle; "> 473<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> 474<li class="listitem">Patterns for things that <a href="http://martinfowler.com/ap2/timeNarrative.html" target="_top">Change with time</a> 475</li> 476</ul></div> 477</li> 478<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> 479</li> 480<li class="listitem" style="list-style-type: disc">Network Time Protocol at <a href="http://www.ntp.org/" target="_top">NTP.org</a> 481</li> 482<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> 483</li> 484<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> 485<li class="listitem" style="list-style-type: disc"> 486<a href="http://beta.zyprexia.com/docs/pgsql/user/datatype1130.htm" target="_top">Date-Time type PostgreSQL</a> User Guide </li> 487</ul></div> 488<p> 489 </p> 490<a name="other_c_libs"></a><h4> 491<a name="id-1.3.14.13.6.11"></a>Other C/C++ Libraries</h4> 492<p> 493 </p> 494<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 495<li class="listitem" style="list-style-type: disc"> 496<a href="http://www.cplusplus.com/ref/ctime/index.html" target="_top">ctime C</a> Standard library reference at cplusplus.com</li> 497<li class="listitem" style="list-style-type: disc"> 498<a href="http://www.cl.cam.ac.uk/~mgk25/c-time/" target="_top">XTime C extension</a> proposal</li> 499<li class="listitem" style="list-style-type: disc"> 500<a href="http://david.tribble.com/text/c0xcalendar.html#author-info" target="_top">Another C library extension proposal</a> by David Tribble</li> 501<li class="listitem" style="list-style-type: disc"> 502<a href="http://cr.yp.to/libtai.html" target="_top">libTAI</a> is a C based time library</li> 503<li class="listitem" style="list-style-type: disc"> 504<a href="http://www.twinsun.com/tz/tz-link.htm" target="_top">Time Zone Database</a> C library for managing timezones/places</li> 505<li class="listitem" style="list-style-type: disc">International Components for Unicode by IBM (open source) 506 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: opencircle; "> 507<li class="listitem"><a href="http://icu.sourceforge.net/userguide/dateCalendar.html" target="_top">Calendar Class</a></li> 508<li class="listitem"><a href="http://icu.sourceforge.net/userguide/dateTime.html" target="_top">Date Time Services</a></li> 509<li class="listitem"><a href="http://oss.software.ibm.com/userguide/dateTimezone.html" target="_top">Time Zone Class</a></li> 510<li class="listitem"><a href="http://oss.software.ibm.com/userguide/formatDateTime.html" target="_top">Date-Time Formatting</a></li> 511</ul></div> 512</li> 513<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> 514</ul></div> 515<p> 516 </p> 517<a name="java_libs"></a><h4> 518<a name="id-1.3.14.13.6.14"></a>JAVA Date & Time Library Quick Reference</h4> 519<p> 520 </p> 521<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 522<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> 523<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> 524<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> 525<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> 526<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> 527<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> 528<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> 529<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> 530</ul></div> 531<p> 532 </p> 533<a name="script_libs"></a><h4> 534<a name="id-1.3.14.13.6.17"></a>Scripting Language Libraries</h4> 535<p> 536 </p> 537<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 538<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> 539</li> 540<li class="listitem" style="list-style-type: disc">Perl date-time 541 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: opencircle; "> 542<li class="listitem"><a href="http://search-dev.develooper.com/search?m=module&q=date&s=11" target="_top">Date-Time packages at CPAN</a></li> 543<li class="listitem"> 544<a href="http://search-dev.develooper.com/~stbey/Date-Calc-5.4/Calc.pod" target="_top">Date::Calc</a> at CPAN</li> 545<li class="listitem"> 546<a href="http://search.cpan.org/doc/MORTY/DateConvert-0.16/Convert.pm" target="_top">Date::Convert</a> calendar conversions at CPAN</li> 547</ul></div> 548</li> 549</ul></div> 550<p> 551 </p> 552<a name="related"></a><h4> 553<a name="id-1.3.14.13.6.20"></a>Related Commercial and Fanciful Pages</h4> 554<p> 555 </p> 556<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 557<li class="listitem" style="list-style-type: disc"> 558<a href="http://www.craphound.com/est/" target="_top">Eastern Standard Tribe</a> -- Cory Doctorow science fiction novel with time themes.</li> 559<li class="listitem" style="list-style-type: disc"> 560<a href="http://www.leapsecond.com/java/gpsclock.htm" target="_top">Leapsecond.com time</a> page</li> 561<li class="listitem" style="list-style-type: disc"><a href="http://www.worldtimeserver.com" target="_top">World Time Server / TZ database</a></li> 562<li class="listitem" style="list-style-type: disc"> 563<a href="http://www.longnow.org/10kclock/clock.htm" target="_top">10000 year clock</a> at Long Now Foundation</li> 564<li class="listitem" style="list-style-type: disc"><a href="http://www.timezonesforpcs.com" target="_top">Timezones for PCs</a></li> 565</ul></div> 566<p> 567 </p> 568<a name="resolution"></a><h4> 569<a name="id-1.3.14.13.6.23"></a>Resolution, Precision, and Accuracy</h4> 570<p> 571 </p> 572<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 573<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> 574</li> 575<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> 576</li> 577</ul></div> 578<p> 579 </p> 580</div> 581<div class="section"> 582<div class="titlepage"><div><div><h3 class="title"> 583<a name="date_time.buildinfo"></a>Build-Compiler Information</h3></div></div></div> 584<p> 585 <a class="link" href="details.html#overview">Overview</a> -- 586 <a class="link" href="details.html#compile_options">Compilation Options</a> -- 587 <a class="link" href="details.html#portability">Compiler/Portability Notes</a> -- 588 <a class="link" href="details.html#dir_structure">Directory Structure</a> -- 589 <a class="link" href="details.html#other_boost_libs">Required Boost Libraries</a> 590 </p> 591<a name="overview"></a><h4> 592<a name="id-1.3.14.13.7.4"></a>Overview</h4> 593<p> 594 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. 595 </p> 596<a name="compile_options"></a><h4> 597<a name="id-1.3.14.13.7.7"></a>Compilation Options</h4> 598<p> 599 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. 600 </p> 601<p> 602 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. 603 </p> 604<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> 605<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> 606<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> 607<a name="portability"></a><h4> 608<a name="id-1.3.14.13.7.14"></a>Compiler/Portability Notes</h4> 609<p> 610 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: 611 </p> 612<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 613<li class="listitem" style="list-style-type: disc">Codewarrior 9.4 Windows</li> 614<li class="listitem" style="list-style-type: disc">GCC 3.2 - 3.4, 4.x on Linux</li> 615<li class="listitem" style="list-style-type: disc">GCC 3.3, 4.x on Darwin</li> 616<li class="listitem" style="list-style-type: disc">GCC 3.3 - 3.4, 4.x on Solaris</li> 617<li class="listitem" style="list-style-type: disc">GCC 3.3, 4.x on HP-UX</li> 618<li class="listitem" style="list-style-type: disc">QCC 3.3.5 on QNX</li> 619<li class="listitem" style="list-style-type: disc">MSVC 7.1 Windows </li> 620<li class="listitem" style="list-style-type: disc">Intel 8.1-9.x Linux and Windows</li> 621</ul></div> 622<p> 623 </p> 624<p> 625 Unfortunately, the VC8 compiler has some issues with date-time code. 626 The most serious issue is a memory leak which was introduced into the 627 VC8 standard library basic_stream code. Date-time has code has been changed 628 to avoid this as much as possible, but if you are using the legacy IO option 629 (NOT the default with VC8) then the issue can still arise. See the 630 631 <a href="http://lists.boost.org/Archives/boost/2006/02/101122.php" target="_top">mailing list archive</a> for more details. 632 </p> 633<p> 634 In addition to the problem above, some versions of the VC8 library have limited 635 the range of allowed 636 values in the <code class="computeroutput">std::tm</code> structure to positive values. This was a new 637 restriction added in the VC8. The effect is that dates prior to the year 638 1900 will cause exceptions. There is, unfortunately, no easy workaround for 639 this issue. Note that the new 64bit version of the VC8 compiler 640 does not appear to have this limitation. 641 </p> 642<p> 643 These compilers support all aspects of the library except <code class="computeroutput">wstring/wstream</code> 644 output. 645 </p> 646<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 647<li class="listitem" style="list-style-type: disc">MinGW 3.2, 3.4, 3.5 *</li> 648<li class="listitem" style="list-style-type: disc">GCC 3.2 (cygwin) *</li> 649</ul></div> 650<p> 651 </p> 652<p> 653 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: 654 </p> 655<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> 656<p> 657 </p> 658<p> 659 Official support for some older compilers has now been dropped. This includes: 660 </p> 661<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 662<li class="listitem" style="list-style-type: disc">GCC 2.9x</li> 663<li class="listitem" style="list-style-type: disc">Borland 5.1.1</li> 664<li class="listitem" style="list-style-type: disc">MSVC 7.0 and 6 SP5 </li> 665</ul></div> 666<p> 667 </p> 668<h6> 669<a name="id-1.3.14.13.7.21"></a>Visual Studio & STLPort</h6> 670<p>There is a known issue with Visual Studio (7.0 & 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. 671 </p> 672<p>To build date_time with no wide stream/string etc, execute the following command from <code class="computeroutput">$BOOST_ROOT</code>: 673 </p> 674<pre class="screen">bjam -a "-sTOOLS=vc-7_1-stlport" "-sSTLPORT_PATH=..." \ 675 "-sBUILD=<define>BOOST_NO_STD_WSTRING" \ 676 --stagedir=... --with-date_time stage</pre> 677<p> 678 (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) 679 </p> 680<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>: 681 </p> 682<pre class="screen">bjam -a "-sTOOLS=vc-7_1-stlport" "-sSTLPORT_PATH=..." \ 683 "-sBUILD=&native-wchar_t>on" \ 684 --stagedir=... --with-date_time stage</pre> 685<p> 686 (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) 687 </p> 688<a name="dir_structure"></a><h4> 689<a name="id-1.3.14.13.7.26"></a>Directory Structure</h4> 690<p> 691 The directory tree has the following structure: 692 </p> 693<pre class="programlisting">/boost/date_time -- common headers and template code 694/boost/date_time/gregorian -- Gregorian date system header files 695/boost/date_time/posix_time -- Posix time system headers 696/boost/date_time/local_time -- Local time system headers 697/libs/date_time/build -- build files and output directory 698/libs/date_time/test -- test battery for generic code 699/libs/date_time/test/gregorian -- test battery for the Gregorian system 700/libs/date_time/test/posix_time -- test battery for the posix_time system 701/libs/date_time/test/local_time -- test battery for the local_time system 702/libs/date_time/example/gregorian -- example programs for dates 703/libs/date_time/example/posix_time -- time example programs 704/libs/date_time/example/local_time -- nifty example programs 705/libs/date_time/src/gregorian -- cpp files for libboost_date_time 706/libs/date_time/src/posix_time -- empty (one file, but no source code...)</pre> 707<p> 708 </p> 709<a name="other_boost_libs"></a><h4> 710<a name="id-1.3.14.13.7.29"></a>Required Boost Libraries</h4> 711<p> 712 Various parts of date-time depend on other boost libraries. These include: 713 </p> 714<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "> 715<li class="listitem" style="list-style-type: disc"><a href="../../../libs/tokenizer/index.html" target="_top">boost.tokenizer</a></li> 716<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> 717<li class="listitem" style="list-style-type: disc"><a href="../../../libs/utility/operators.htm" target="_top">boost.operators</a></li> 718<li class="listitem" style="list-style-type: disc"><a href="../../../libs/lexical_cast/index.html" target="_top">boost.lexical_cast </a></li> 719<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> 720<li class="listitem" style="list-style-type: disc"><a href="../../../libs/algorithm/string/index.html" target="_top">boost::string_algorithms </a></li> 721<li class="listitem" style="list-style-type: disc"><a href="../../../libs/serialization/index.html" target="_top">boost::serialize (serialization code only) </a></li> 722</ul></div> 723<p> 724 so these libraries need to be installed. 725 </p> 726</div> 727<div class="section"> 728<div class="titlepage"><div><div><h3 class="title"> 729<a name="date_time.tests"></a>Tests</h3></div></div></div> 730<p> 731 The library provides a large number of tests in the 732 </p> 733<pre class="programlisting"> 734 libs/date_time/test 735 libs/date_time/test/gregorian 736 libs/date_time/test/posix_time 737 libs/date_time/test/local_time 738 </pre> 739<p> 740 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. 741 </p> 742</div> 743<div class="section"> 744<div class="titlepage"><div><div><h3 class="title"> 745<a name="date_time.changes"></a>Change History</h3></div></div></div> 746<h4> 747<a name="id-1.3.14.13.9.2"></a>Changes from Boost 1.73 to 1.74 </h4> 748<div class="informaltable"><table class="table"> 749<colgroup> 750<col> 751<col> 752</colgroup> 753<thead><tr> 754<th>Type</th> 755<th>Description</th> 756</tr></thead> 757<tbody> 758<tr> 759<td>Bug-Fix</td> 760<td> 761 Fix constrained_value::assign to be constexpr so ptime and date construction are constexpr. See: 762 <a href="https://github.com/boostorg/date_time/pull/161" target="_top">pull 161</a> and 763 <a href="https://github.com/boostorg/date_time/pull/162" target="_top">pull 161</a>. 764 </td> 765</tr> 766<tr> 767<td>Bug-Fix</td> 768<td> 769 Suppress MSVC CRT deprecations on Clang. See: 770 <a href="https://github.com/boostorg/date_time/pull/160" target="_top">pull 160</a>. 771 </td> 772</tr> 773</tbody> 774</table></div> 775<h4> 776<a name="id-1.3.14.13.9.4"></a>Changes from Boost 1.72 to 1.73 </h4> 777<div class="informaltable"><table class="table"> 778<colgroup> 779<col> 780<col> 781</colgroup> 782<thead><tr> 783<th>Type</th> 784<th>Description</th> 785</tr></thead> 786<tbody> 787<tr> 788<td>Enhancement</td> 789<td> 790 Make date_time all inline. Users no longer need to link the library for any library functions. 791 Note that an empty stub library is maintained for backward compatibility. Resolves: 792 (<a href="https://github.com/boostorg/date_time/issues/134" target="_top">github issue #134</a>) and 793 (<a href="https://github.com/boostorg/date_time/issues/85" target="_top">github issue #85</a>). 794 795Remove the link library to resolve linking/visibility concerns 796 </td> 797</tr> 798<tr> 799<td>Enhancement</td> 800<td> 801 Support for constexpr has been added when in c++14 mode and above. For example: 802 <code class="computeroutput"> 803 constexpr microseconds ms(1000); 804 static_assert(ms.total_microseconds() == 1000, "constexpr total_microseconds"); 805 </code> 806 (<a href="https://github.com/boostorg/date_time/issues/123" target="_top">github issue #123</a>). 807 </td> 808</tr> 809<tr> 810<td>Enhancement</td> 811<td> 812 C++20 ambiguous comparison operator warning with clang 10 813 (<a href="https://github.com/boostorg/date_time/issues/132" target="_top">github issue #132</a>). 814 </td> 815</tr> 816<tr> 817<td>Cleanup</td> 818<td> 819 Deprecated support for legacy io and USE_DATE_TIME_PRE_1_33_FACET_IO macro 820 (<a href="https://github.com/boostorg/date_time/issues/61" target="_top">github issue #61</a>). 821 </td> 822</tr> 823<tr> 824<td>Bug Fix</td> 825<td> 826 Documentation clarifications for gettimeofday, day_number, and from_iso_extended_string. 827 <a href="https://github.com/boostorg/date_time/issues/127" target="_top">github issue #127</a> 828 <a href="https://github.com/boostorg/date_time/issues/125" target="_top">github issue #125</a>, and 829 <a href="https://github.com/boostorg/date_time/issues/116" target="_top">github issue #116</a> 830 </td> 831</tr> 832</tbody> 833</table></div> 834<h4> 835<a name="id-1.3.14.13.9.6"></a>Changes from Boost 1.41 to 1.44 (date_time 1.08 to 1.09)</h4> 836<div class="informaltable"><table class="table"> 837<colgroup> 838<col> 839<col> 840</colgroup> 841<thead><tr> 842<th>Type</th> 843<th>Description</th> 844</tr></thead> 845<tbody><tr> 846<td>Bug fix</td> 847<td> 848 The "%T" and "%R" format specifiers are now processed by the library rather than underlying standard facet. 849 This fixes the cases when the placeholders are not supported by the facet 850 (<a href="https://svn.boost.org/trac/boost/ticket/3876" target="_top">#3876</a>). 851 </td> 852</tr></tbody> 853</table></div> 854<h4> 855<a name="id-1.3.14.13.9.8"></a>Changes from Boost 1.40 to 1.41 (date_time 1.07 to 1.08)</h4> 856<div class="informaltable"><table class="table"> 857<colgroup> 858<col> 859<col> 860</colgroup> 861<thead><tr> 862<th>Type</th> 863<th>Description</th> 864</tr></thead> 865<tbody> 866<tr> 867<td>Change</td> 868<td> 869 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>). 870 </td> 871</tr> 872<tr> 873<td>Bug fix</td> 874<td> 875 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>). 876 </td> 877</tr> 878<tr> 879<td>Bug fix</td> 880<td> 881 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>). 882 </td> 883</tr> 884</tbody> 885</table></div> 886<h4> 887<a name="id-1.3.14.13.9.10"></a>Changes from Boost 1.38 to 1.40 (date_time 1.06 to 1.07)</h4> 888<div class="informaltable"><table class="table"> 889<colgroup> 890<col> 891<col> 892</colgroup> 893<thead><tr> 894<th>Type</th> 895<th>Description</th> 896</tr></thead> 897<tbody><tr> 898<td>Bug fix</td> 899<td> 900 Minor bug fixes (<a href="https://svn.boost.org/trac/boost/ticket/2809" target="_top">#2809</a>, 901 <a href="https://svn.boost.org/trac/boost/ticket/2824" target="_top">#2824</a>, 902 <a href="https://svn.boost.org/trac/boost/ticket/3015" target="_top">#3015</a>, 903 <a href="https://svn.boost.org/trac/boost/ticket/3105" target="_top">#3105</a> and others). 904 </td> 905</tr></tbody> 906</table></div> 907<h4> 908<a name="id-1.3.14.13.9.12"></a>Changes from Boost 1.34 to 1.38 (date_time 1.05 to 1.06)</h4> 909<div class="informaltable"><table class="table"> 910<colgroup> 911<col> 912<col> 913</colgroup> 914<thead><tr> 915<th>Type</th> 916<th>Description</th> 917</tr></thead> 918<tbody> 919<tr> 920<td>Feature</td> 921<td> 922 Added support for formatting and reading time durations longer than 24 hours. 923 A new formatter <code class="computeroutput">%O</code> is used indicate such long durations in the 924 format string. The old <code class="computeroutput">%H</code> format specifier is thus restricted 925 to represent durations that fit into two characters, in order to retain support 926 for reading durations in ISO format. In case if it is detected that the <code class="computeroutput">%H</code> 927 format specifier is used with longer durations, the results are not specified 928 (an assertion in debug builds is raised). 929 </td> 930</tr> 931<tr> 932<td>Bug fix</td> 933<td> 934 Added support for GCC 4.3. Several compilation issues were solved, as well as 935 compiler warnings were taken care of. 936 </td> 937</tr> 938<tr> 939<td>Bug fix</td> 940<td> 941 Added missing streaming operators for the <code class="computeroutput">local_time_period</code> class. 942 </td> 943</tr> 944<tr> 945<td>Bug fix</td> 946<td> 947 Added several missing includes in different places. Some includes that are 948 not needed in some configurations were made conditional. 949 </td> 950</tr> 951<tr> 952<td>Bug fix</td> 953<td> 954 Solved compilation problem that was caused by not finding streaming operators 955 for <code class="computeroutput">gregorian::date_duration</code> via ADL. The type is now made actually 956 a class rather a typedef for the <code class="computeroutput">date_time::date_duration</code> template. 957 The similar change was done for <code class="computeroutput">gregorian::weeks</code>. 958 </td> 959</tr> 960<tr> 961<td>Bug fix</td> 962<td> 963 Added a correctly spelled <code class="computeroutput">date_time::hundredth</code> time resolution enum 964 value. The old one <code class="computeroutput">date_time::hundreth</code> is considered deprecated and 965 to be removed in future releases. 966 </td> 967</tr> 968<tr> 969<td>Bug fix</td> 970<td> 971 Fixed compilation error in <code class="computeroutput">format_date_parser.hpp</code> because of incorrect 972 stream type being used. 973 </td> 974</tr> 975<tr> 976<td>Bug fix</td> 977<td> 978 On Windows platform made inclusion of <code class="computeroutput">windows.h</code> optional. The header is only used 979 when the <code class="computeroutput">BOOST_USE_WINDOWS_H</code> macro is defined. Otherwise (and by default), 980 the library uses internal definitions of symbols from this header. 981 </td> 982</tr> 983<tr> 984<td>Bug fix</td> 985<td> 986 On Windows platform function <code class="computeroutput">from_ftime</code> could return incorrect time if 987 the <code class="computeroutput">FILETIME</code> that is being passed to the function contained dates before 1970-Jan-01. 988 </td> 989</tr> 990<tr> 991<td>Bug fix</td> 992<td> 993 Fixed a possible crash in <code class="computeroutput">gregorian::special_value_from_string</code> if the string 994 did not represent a valid special value. 995 </td> 996</tr> 997<tr> 998<td>Bug fix</td> 999<td> 1000 Removed the <code class="computeroutput">testfrmwk.hpp</code> file from the public include directory. This file 1001 was internal for the library tests and was not documented. 1002 </td> 1003</tr> 1004<tr> 1005<td>Bug fix</td> 1006<td> 1007 Fixed missing include in <code class="computeroutput">filetime_functions.hpp</code> 1008 (<a href="https://svn.boost.org/trac/boost/ticket/2688" target="_top">#2688</a>). 1009 </td> 1010</tr> 1011<tr> 1012<td>Bug fix</td> 1013<td> 1014 Fixed dereferencing end string iterators in different places of code, 1015 which could cause crashes on MSVC 1016 (<a href="https://svn.boost.org/trac/boost/ticket/2698" target="_top">#2698</a>). 1017 </td> 1018</tr> 1019</tbody> 1020</table></div> 1021<h4> 1022<a name="id-1.3.14.13.9.14"></a>Changes from Boost 1.33 to 1.34 (date_time 1.04 to 1.05)</h4> 1023<div class="informaltable"><table class="table"> 1024<colgroup> 1025<col> 1026<col> 1027</colgroup> 1028<thead><tr> 1029<th>Type</th> 1030<th>Description</th> 1031</tr></thead> 1032<tbody> 1033<tr> 1034<td>Feature</td> 1035<td> 1036 Updated the data in the date_time_zonespec.csv file to reflect new US/Canada 1037 daylight savings time rules for 2007. If you upgrade to the new file, be aware 1038 that the library will only give correct answers for current/future date 1039 conversions. So if you are converting dates from earlier years the answers 1040 will reflect current time zone rules not past rules. The library doesn't support 1041 historic timezone rules presently. 1042 </td> 1043</tr> 1044<tr> 1045<td>Feature</td> 1046<td> 1047 Two other dst calculation features have also been update to reflect the new 1048 US/Canada timzone rules. This is the boost::date_time::us_dst_rules and 1049 dst_calc_engine. While the us_dst_rules is officially deprecated, a patch 1050 by Graham Bennett has been applied which allows this class to work correctly 1051 for both historical and future dates. The dst_calc_engine was updated to also 1052 work for historical and future times. This allows the various local_adjustor 1053 classes to work correctly. There was an interface change for classes using the 1054 dst_calc_engine with custom dst traits classes. The traits classes signatures 1055 changed to take a 'year' parameter on most of the methods such as end_month. 1056 In addition, 2 new functions are needed on the traits classes: 1057 <code class="computeroutput">static date_type local_dst_start_day(year_type year)</code> and 1058 <code class="computeroutput">static date_type local_dst_end_day(year_type year)</code>. 1059 Implementers should see <code class="computeroutput">date_time/local_timezone_defs.hpp</code> for 1060 examples. 1061 </td> 1062</tr> 1063<tr> 1064<td>Bug Fix</td> 1065<td>Fix DST traits for Austrialia (sf# 1672139) to set end of DST at 3:00 am instead of 2:00 am. 1066 </td> 1067</tr> 1068<tr> 1069<td>Bug Fix</td> 1070<td>Fix a problem with potential linking error with multiple definitions due 1071 to I/O code. 1072 </td> 1073</tr> 1074<tr> 1075<td>Bug Fix</td> 1076<td>Changed serialization code in both greg_serialize.hpp and time_serialize.hpp 1077 to eliminate warnings due to unused variables for version and file_version. 1078 Thanks to Caleb Epstein for the patch suggestion. 1079 </td> 1080</tr> 1081<tr> 1082<td>Bug Fix</td> 1083<td>Fix regression errors that showed up under FreeBSD with GCC and the 1084 LANG environment set to russian -- changed parser to use classic 1085 locale instead of blank locale. 1086 </td> 1087</tr> 1088<tr> 1089<td>Bug Fix</td> 1090<td>Changes for tracker issue 1178092 -- change in convert_to_lower to make 1091 local a const static and speed up parsing. 1092 </td> 1093</tr> 1094<tr> 1095<td>Bug Fix</td> 1096<td>Patches from Ulrich Eckhardt to fix support for EVC++ 4. 1097 </td> 1098</tr> 1099<tr> 1100<td>Feature</td> 1101<td>Reduce the usage of basic_stringstream as much a possible to work around 1102 a bug in the VC8 standard library. See 1103 <a href="http://lists.boost.org/Archives/boost/2006/02/101122.php" target="_top">mailing list archive</a> 1104 for more information. 1105 </td> 1106</tr> 1107</tbody> 1108</table></div> 1109<h4> 1110<a name="id-1.3.14.13.9.16"></a>Changes from Boost 1.32 to 1.33 (date_time 1.03 to 1.04)</h4> 1111<div class="informaltable"><table class="table"> 1112<colgroup> 1113<col> 1114<col> 1115</colgroup> 1116<thead><tr> 1117<th>Type</th> 1118<th>Description</th> 1119</tr></thead> 1120<tbody> 1121<tr> 1122<td>Bug Fix</td> 1123<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. 1124 </td> 1125</tr> 1126<tr> 1127<td>Bug Fix</td> 1128<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. 1129 </td> 1130</tr> 1131<tr> 1132<td>Feature</td> 1133<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. 1134 </td> 1135</tr> 1136<tr> 1137<td>Feature</td> 1138<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. 1139 </td> 1140</tr> 1141<tr> 1142<td>Bug Fix</td> 1143<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. 1144 </td> 1145</tr> 1146<tr> 1147<td>Bug Fix</td> 1148<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. 1149 </td> 1150</tr> 1151<tr> 1152<td>Bug Fix</td> 1153<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()). 1154 </td> 1155</tr> 1156<tr> 1157<td>Bug Fix</td> 1158<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'). 1159 </td> 1160</tr> 1161<tr> 1162<td>Feature</td> 1163<td>Major new features related to management of local times. 1164 This includes the introduction of a series of new classes to 1165 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). 1166 </td> 1167</tr> 1168<tr> 1169<td>Feature</td> 1170<td>Input and output facets have been re-written to support format-based 1171 redefinition of formats (see <a class="link" href="date_time_io.html" title="Date Time Input/Output">Date Time IO</a> for complete details). 1172 </td> 1173</tr> 1174<tr> 1175<td>Feature</td> 1176<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. 1177 </td> 1178</tr> 1179<tr> 1180<td>Feature</td> 1181<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>). 1182 </td> 1183</tr> 1184<tr> 1185<td>Feature</td> 1186<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. 1187 </td> 1188</tr> 1189<tr> 1190<td>Feature</td> 1191<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>). 1192 </td> 1193</tr> 1194<tr> 1195<td>Feature</td> 1196<td>Date-time now uses reentrant POSIX functions on those platforms that 1197 support them when BOOST_HAS_THREADS is defined. 1198 </td> 1199</tr> 1200<tr> 1201<td>Bug Fix</td> 1202<td>Fixed a bug in serialization code where special values 1203 (not-a-date-time, infinities, etc) for 1204 ptime, time_duration would not read back correctly from an archive. 1205 The output serialization code wrote subfields such 1206 as time_duration.seconds() which are invalid for special values and 1207 thus undefined values. Thus when read back the values could cause 1208 strange behavior including execeptions on construction. 1209 </td> 1210</tr> 1211<tr> 1212<td>Bug Fix</td> 1213<td>Fixed multiple warnings generated with various platforms/compilers. 1214 </td> 1215</tr> 1216<tr> 1217<td>Bug Fix</td> 1218<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> -> "2005-Jan-31 19:00:00" & <code class="computeroutput">ptime(date(2005,2,1), hours(35))</code> -> "2005-Feb-02 11:00:00"). 1219 </td> 1220</tr> 1221<tr> 1222<td>Bug Fix</td> 1223<td>Time parsing now correctly handles excessive digits for fractional seconds. Leading zeros are dropped ("000100" -> 100 frac_sec), and excessive digits are truncated at the proper place ("123456789876" -> 123456 or 123456789 depending on what precision the library was compiled with). 1224 </td> 1225</tr> 1226<tr> 1227<td>Bug Fix</td> 1228<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: 1229 <pre class="screen">template<class archive_type, class temporal_type> 1230void save_to(archive_type& ar, 1231 const temporal_type& tt) 1232{ 1233 ar << tt; 1234}</pre> 1235 </td> 1236</tr> 1237<tr> 1238<td>Bug Fix</td> 1239<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. 1240 </td> 1241</tr> 1242<tr> 1243<td>Bug Fix</td> 1244<td>Templatized formatters in the legacy IO system to accept char type. Also removed calls to <code class="computeroutput">boost::lexical_cast</code>. 1245 </td> 1246</tr> 1247</tbody> 1248</table></div> 1249<h4> 1250<a name="id-1.3.14.13.9.18"></a>Changes from Boost 1.31 to 1.32 (date_time 1.02 to 1.03)</h4> 1251<div class="informaltable"><table class="table"> 1252<colgroup> 1253<col> 1254<col> 1255</colgroup> 1256<thead><tr> 1257<th>Type</th> 1258<th>Description</th> 1259</tr></thead> 1260<tbody> 1261<tr> 1262<td>Bug Fix</td> 1263<td>Snap to end of month behavior corrected for year_functor. Previously, starting 1264 from 2000-Feb-28 (leap year and not end of month) and iterating through the next 1265 leap year would result in 2004-Feb-29 instead of 2004-Feb-28. This behavior has 1266 been corrected to produce the correct result of 2004-Feb-28. Thanks to Bart Garst 1267 for this change. 1268 </td> 1269</tr> 1270<tr> 1271<td>Feature</td> 1272<td>Free function for creating a ptime object from a FILETIME struct. This function 1273 is only available on platforms that define BOOST_HAS_FTIME. 1274 </td> 1275</tr> 1276<tr> 1277<td>Feature</td> 1278<td>Microsecond time clock is now available on most windows compilers as well as 1279 Unix. 1280 </td> 1281</tr> 1282<tr> 1283<td>Feature</td> 1284<td>Use of the boost::serialization library is now available with most of the 1285 date_time classes. Classes capable of serialization are: date_generator classes, 1286 date, days, date_period, greg_month, greg_weekday, greg_day, ptime, time_duration, 1287 and time_period. Thanks to Bart Garst for this change. 1288 </td> 1289</tr> 1290<tr> 1291<td>Feature</td> 1292<td>Functions added to convert date and time classes to wstring. The library now 1293 provides to_*_wstring as well as to_*_string functions for: simple, iso, 1294 iso_extended, and sql for dates and compilers that support wstrings. Thanks to 1295 Bart Garst for this change. 1296 </td> 1297</tr> 1298<tr> 1299<td>Feature</td> 1300<td>Period classes now handle zero length and NULL periods correctly. A NULL period 1301 is a period with a negative length. Thanks to Frank Wolf and Bart Garst for this 1302 change. 1303 </td> 1304</tr> 1305<tr> 1306<td>Feature</td> 1307<td>Added end_of_month function to gregorian::date to return the last day of 1308 the current month represented by the date. Result is undefined for 1309 not_a_date_time or infinities. 1310 </td> 1311</tr> 1312<tr> 1313<td>Bug Fix</td> 1314<td>Removed incorrect usage of BOOST_NO_CWCHAR macro throughout library. 1315 </td> 1316</tr> 1317<tr> 1318<td>Feature</td> 1319<td>New names added for some date classes. Original names are still valid but may 1320 some day be deprecated. Changes are: 1321 <table border="0" summary="Simple list" class="simplelist"> 1322<tr> 1323<td>date_duration</td> 1324<td>is now</td> 1325<td>days</td> 1326</tr> 1327<tr> 1328<td>nth_kday_of_month</td> 1329<td>is now</td> 1330<td>nth_day_of_the_week_in_month</td> 1331</tr> 1332<tr> 1333<td>first_kday_of_month</td> 1334<td>is now</td> 1335<td>first_day_of_the_week_in_month</td> 1336</tr> 1337<tr> 1338<td>last_kday_of_month</td> 1339<td>is now</td> 1340<td>last_day_of_the_week_in_month</td> 1341</tr> 1342<tr> 1343<td>first_kday_after</td> 1344<td>is now</td> 1345<td>first_day_of_the_week_after</td> 1346</tr> 1347<tr> 1348<td>first_kday_before</td> 1349<td>is now</td> 1350<td>first_day_of_the_week_before</td> 1351</tr> 1352</table> 1353 </td> 1354</tr> 1355<tr> 1356<td>Feature</td> 1357<td>Free functions for date generators added. Functions are: days_until_weekday, days_before_weekday, next_weekday, and previous_weekday. 1358 <pre class="screen">days days_until_weekday(date, greg_weekday); 1359days days_before_weekday(date, greg_weekday); 1360date next_weekday(date, greg_weekday); 1361date previous_weekday(date, greg_weekday);</pre> 1362 Thanks to Bart Garst for this change. 1363 </td> 1364</tr> 1365<tr> 1366<td>Feature</td> 1367<td>New experimental duration types added for months, years, and weeks. These classes 1368 also provide mathematical operators for use with date and time classes. Be aware 1369 that adding of months or years a time or date past the 28th of a month may show 1370 non-normal mathematical properties. This is a result of 'end-of-month' 1371 snapping used in the calculation. The last example below illustrates the 1372 issue. 1373 1374 <pre class="screen">months m(12); 1375years y(1); 1376m == y; // true 1377days d(7); 1378weeks w(1); 1379d == w; // true 1380ptime t(...); 1381t += months(3); 1382date d(2004,Jan,30); 1383d += months(1); //2004-Feb-29 1384d -= months(1); //2004-Jan-29</pre> 1385 Input streaming is not yet implemented for these types. 1386 Thanks to Bart Garst for this change. 1387 </td> 1388</tr> 1389<tr> 1390<td>Feature</td> 1391<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>. 1392 </td> 1393</tr> 1394<tr> 1395<td>Feature</td> 1396<td>Added constructors for date and ptime that allow for default construction (both) 1397 and special values construction (ptime, both now support this). Default 1398 constructors initialize the objects to not_a_date_time (NADT). 1399 <pre class="screen">ptime p_nadt(not_a_date_time); 1400ptime p_posinf(pos_infin); 1401ptime p; // p == NADT 1402date d; // d == NADT</pre> 1403 Thanks to Bart Garst for this change. 1404 </td> 1405</tr> 1406<tr> 1407<td>Feature</td> 1408<td>Output streaming now supports wide stream output on compiler / standard library combinations that support wide streams. This allows code like: 1409 <pre class="screen">std::wstringstream wss; 1410date d(2003,Aug,21); 1411wss << d;</pre> 1412 Thanks to Bart Garst for this change. 1413 </td> 1414</tr> 1415<tr> 1416<td>Feature</td> 1417<td>Input streaming for date and time types is now supported on both wide and narrow streams: 1418 <pre class="screen">date d(not_a_date_time); 1419std::stringstream ss("2000-FEB-29"); 1420ss >> d; //Feb 29th, 2000 1421std::wstringstream ws("2000-FEB-29"); 1422ws >> d; //Feb 29th, 2000</pre> 1423 Thanks to Bart Garst for this change. 1424 </td> 1425</tr> 1426<tr> 1427<td>Bug Fix</td> 1428<td> Fixed bug in duration_from_string() where a string formatted with 1429 less than full amount of fractional digits created an incorrect 1430 time_duration. With microsecond resolution for time durations 1431 the string "1:01:01.010" created a time duration of 1432 01:01:01.000010 instead of 01:01:01.010000 1433 </td> 1434</tr> 1435<tr> 1436<td>Bug Fix</td> 1437<td>Fixed the special value constructor for gregorian::date and posix_time::ptime 1438 when constructing with min_date_time or max_date_time. The wrong value was 1439 constructed for these. 1440 </td> 1441</tr> 1442</tbody> 1443</table></div> 1444<h4> 1445<a name="id-1.3.14.13.9.20"></a>Changes from Boost 1.30 to 1.31 (date_time 1.01 to 1.02)</h4> 1446<div class="informaltable"><table class="table"> 1447<colgroup> 1448<col> 1449<col> 1450</colgroup> 1451<thead><tr> 1452<th>Type</th> 1453<th>Description</th> 1454</tr></thead> 1455<tbody> 1456<tr> 1457<td>Bug Fix</td> 1458<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> 1459</tr> 1460<tr> 1461<td>Bug Fix</td> 1462<td>Time_duration from_string is now correctly constructed from a negative value. (ie "-0:39:00.000") Code provided by Bart Garst.</td> 1463</tr> 1464<tr> 1465<td>Bug Fix</td> 1466<td>Fixed many MSVC compiler warnings when compiled with warning level 4.</td> 1467</tr> 1468<tr> 1469<td>Feature</td> 1470<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> 1471</tr> 1472<tr> 1473<td>Feature</td> 1474<td>Special_values functionality added for date_duration, time_duration and time classes. Code provided by Bart Garst.</td> 1475</tr> 1476<tr> 1477<td>Bug Fix</td> 1478<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> 1479</tr> 1480<tr> 1481<td>Bug Fix</td> 1482<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> 1483</tr> 1484<tr> 1485<td>Bug Fix</td> 1486<td>Added typedefs to boost::gregorian gregorian_types.hpp various date_generator function classes.</td> 1487</tr> 1488<tr> 1489<td>Feature</td> 1490<td>Added from_time_t function to convert time_t to a ptime.</td> 1491</tr> 1492<tr> 1493<td>Feature</td> 1494<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> 1495</tr> 1496<tr> 1497<td>Feature</td> 1498<td>Added a function to time_duration to get the total number of seconds in a 1499 duration truncating any fractional seconds. In addition, other resolutions 1500 were added to allow for easy conversions. For example 1501 <pre class="screen">seconds(1).total_milliseconds() == 1000 1502seconds(1).total_microseconds() == 1000000 1503hours(1).total_milliseconds() == 3600*1000 //3600 sec/hour 1504seconds(1).total_nanoseconds() == 1000000000</pre> 1505 1506 </td> 1507</tr> 1508<tr> 1509<td>Feature</td> 1510<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> 1511</tr> 1512<tr> 1513<td>Feature</td> 1514<td>Added unary- operators for durations for reversing the sign of a time duration. For example: 1515 <pre class="screen">time_duration td(5,0,0); //5 hours 1516td = -td; //-5 hours</pre> 1517 Thanks to Bart Garst for this work.</td> 1518</tr> 1519<tr> 1520<td>Feature</td> 1521<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> 1522</tr> 1523<tr> 1524<td>Feature</td> 1525<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> 1526</tr> 1527<tr> 1528<td>Bug-Fix</td> 1529<td>Various documentation fixes. Thanks to Bart Garst for updates.</td> 1530</tr> 1531</tbody> 1532</table></div> 1533<h4> 1534<a name="id-1.3.14.13.9.22"></a>Changes from Boost 1.29 to 1.30 (date_time 1.00 to 1.01)</h4> 1535<p> 1536 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); 1537 </p> 1538<div class="informaltable"><table class="table"> 1539<colgroup> 1540<col> 1541<col> 1542</colgroup> 1543<thead><tr> 1544<th>Type</th> 1545<th>Description</th> 1546</tr></thead> 1547<tbody> 1548<tr> 1549<td>Bug Fix</td> 1550<td>Added new experimental feature for Daylight Savings Time calculations. This allows traits based specification of dst rules.</td> 1551</tr> 1552<tr> 1553<td>Feature</td> 1554<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> 1555</tr> 1556<tr> 1557<td>Feature</td> 1558<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> 1559</tr> 1560<tr> 1561<td>Feature</td> 1562<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> 1563</tr> 1564<tr> 1565<td>Feature</td> 1566<td> Added a length function to the period template so that both date_periods and time_periods will now support this function.</td> 1567</tr> 1568<tr> 1569<td>Bug Fix</td> 1570<td>Split Jamfiles so that libs/date_time/build/Jamfile only builds library and /libs/date_time/libs/test/Jamfile which runs tests.</td> 1571</tr> 1572<tr> 1573<td>Bug Fix</td> 1574<td>Fixed many minor documentation issues.</td> 1575</tr> 1576<tr> 1577<td>Bug Fix</td> 1578<td>Removed the DATE_TIME_INLINE macro which was causing link errors. This macro is no longer needed in projects using the library.</td> 1579</tr> 1580<tr> 1581<td>Bug Fix</td> 1582<td>Added missing typedef for year_iterator to gregorian_types.hpp</td> 1583</tr> 1584<tr> 1585<td>Bug Fix</td> 1586<td>Fixed problem with gregorian ostream operators that prevented the use of wide streams.</td> 1587</tr> 1588<tr> 1589<td>Bug-Fix</td> 1590<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> 1591</tr> 1592</tbody> 1593</table></div> 1594</div> 1595<div class="section"> 1596<div class="titlepage"><div><div><h3 class="title"> 1597<a name="date_time.acknowledgements"></a>Acknowledgements</h3></div></div></div> 1598<p> 1599 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. 1600 </p> 1601</div> 1602</div> 1603<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 1604<td align="left"></td> 1605<td align="right"><div class="copyright-footer">Copyright © 2001-2005 CrystalClear Software, Inc<p>Subject to the Boost Software License, Version 1.0. (See accompanying file 1606 <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> 1607</div></td> 1608</tr></table> 1609<hr> 1610<div class="spirit-nav"> 1611<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> 1612</div> 1613</body> 1614</html> 1615