Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49506 - in trunk/libs/date_time: test/local_time test/posix_time xmldoc
From: andrey.semashev_at_[hidden]
Date: 2008-11-01 06:36:58


Author: andysem
Date: 2008-11-01 06:36:57 EDT (Sat, 01 Nov 2008)
New Revision: 49506
URL: http://svn.boost.org/trac/boost/changeset/49506

Log:
Fixed a number of misprints in the documentation, added change notes for
the latest commit. The tests are modified to support the latest changes.

Text files modified:
   trunk/libs/date_time/test/local_time/testlocal_time_facet.cpp | 26 ++++++++--
   trunk/libs/date_time/test/posix_time/testmicrosec_time_clock.cpp | 4 +
   trunk/libs/date_time/xmldoc/changes.xml | 92 ++++++++++++++++++++++++++++++++++++++++
   trunk/libs/date_time/xmldoc/date_class.xml | 8 +-
   trunk/libs/date_time/xmldoc/format_flags.xml | 8 +++
   trunk/libs/date_time/xmldoc/gregorian.xml | 2
   trunk/libs/date_time/xmldoc/snap_to_details.xml | 4
   7 files changed, 130 insertions(+), 14 deletions(-)

Modified: trunk/libs/date_time/test/local_time/testlocal_time_facet.cpp
==============================================================================
--- trunk/libs/date_time/test/local_time/testlocal_time_facet.cpp (original)
+++ trunk/libs/date_time/test/local_time/testlocal_time_facet.cpp 2008-11-01 06:36:57 EDT (Sat, 01 Nov 2008)
@@ -17,15 +17,21 @@
 template<class temporal_type, typename charT>
 inline
 void
-teststreaming(std::string testname,
+teststreaming(std::string const& testname,
               temporal_type value,
- std::basic_string<charT> expected_result,
+ std::basic_string<charT> const& expected_result,
               const std::locale& locale)
 {
   std::basic_stringstream<charT> ss;
   ss.imbue(locale);
   ss << value;
- check(testname, ss.str() == expected_result);
+
+ if (!check(testname, ss.str() == expected_result))
+#if !defined(BOOST_NO_STD_WSTRING)
+ std::wcout << L"Expected: \"" << expected_result.c_str() << L"\"\nGot: \"" << ss.str().c_str() << L"\"" << std::endl;
+#else
+ std::cout << "Expected: \"" << expected_result.c_str() << "\"\nGot: \"" << ss.str().c_str() << L"\"" << std::endl;
+#endif
 }
 
 int main(){
@@ -72,8 +78,10 @@
   local_date_time ldt4(b_time, la);
   local_date_time ldt5(a_time, nyc);
   local_date_time ldt6(b_time, phx);
-
-
+
+ local_time_period ltp1(ldt1, hours(10) + minutes(24) + seconds(5));
+ local_time_period ltp2(ldt4, hours(15) + minutes(20) + seconds(41));
+
   typedef boost::date_time::time_facet<local_date_time, char> ldt_facet;
   //ldt_facet* timefacet = new ldt_facet("%c %Z"); // full name
   ldt_facet* timefacet = new ldt_facet("%a %b %d %H:%M:%S %Y %Z"); // full name
@@ -94,7 +102,10 @@
   teststreaming("Los Angeles in summer", ldt4, std::string("Sun Aug 15 05:00:00 2004 Pacific Daylight Time"), loc1);
   teststreaming("New York in winter", ldt5, std::string("Wed Dec 15 07:00:00 2004 Eastern Standard Time"), loc1);
   teststreaming("Phoenix in Summer", ldt6, std::string("Sun Aug 15 05:00:00 2004 Mountain Standard Time"), loc1);
-
+
+ teststreaming("UTC local_time_period", ltp1, std::string("[Wed Dec 15 12:00:00 2004 Coordinated Universal Time/Wed Dec 15 22:24:04 2004 Coordinated Universal Time]"), loc1);
+ teststreaming("LA local_time_period", ltp2, std::string("[Sun Aug 15 05:00:00 2004 Pacific Daylight Time/Sun Aug 15 20:20:40 2004 Pacific Daylight Time]"), loc1);
+
   //ptimefacet1->format("%c %z"); // show that zone abbrev is ignored
   ptimefacet1->format("%a %b %d %H:%M:%S %Y %z"); // show that zone abbrev is ignored
   std::cout << "\nTime zone abbreviation tests" << std::endl;
@@ -169,6 +180,9 @@
   teststreaming("UTC local_date_time", ldt1, std::wstring(L"Wed Dec 15 12:00:00 2004 Coordinated Universal Time"), loc3);
   teststreaming("Chicago in summer", ldt2, std::wstring(L"Sun Aug 15 07:00:00 2004 Central Daylight Time") , loc3);
  
+ teststreaming("UTC local_time_period", ltp1, std::wstring(L"[Wed Dec 15 12:00:00 2004 Coordinated Universal Time/Wed Dec 15 22:24:04 2004 Coordinated Universal Time]"), loc3);
+ teststreaming("LA local_time_period", ltp2, std::wstring(L"[Sun Aug 15 05:00:00 2004 Pacific Daylight Time/Sun Aug 15 20:20:40 2004 Pacific Daylight Time]"), loc3);
+
   //wtimefacet->format(L"%c %z"); // abbrev
   wtimefacet->format(L"%a %b %d %H:%M:%S %Y %z"); // abbrev
   std::cout << "\nAbbreviated time zone names tests - wide stream" << std::endl;

Modified: trunk/libs/date_time/test/posix_time/testmicrosec_time_clock.cpp
==============================================================================
--- trunk/libs/date_time/test/posix_time/testmicrosec_time_clock.cpp (original)
+++ trunk/libs/date_time/test/posix_time/testmicrosec_time_clock.cpp 2008-11-01 06:36:57 EDT (Sat, 01 Nov 2008)
@@ -8,7 +8,9 @@
 #include "boost/date_time/posix_time/posix_time.hpp"
 #include "boost/date_time/microsec_time_clock.hpp"
 #include "boost/date_time/testfrmwk.hpp"
-
+#if defined(BOOST_HAS_FTIME)
+#include <windows.h>
+#endif
 
 int
 main()

Modified: trunk/libs/date_time/xmldoc/changes.xml
==============================================================================
--- trunk/libs/date_time/xmldoc/changes.xml (original)
+++ trunk/libs/date_time/xmldoc/changes.xml 2008-11-01 06:36:57 EDT (Sat, 01 Nov 2008)
@@ -12,6 +12,98 @@
   
   <!-- if each new change tgroup has a "Bug Fix" as the first "Type", the columns will line up nicely -->
 
+ <bridgehead renderas="sect3">Changes from Boost 1.34 to 1.37 (date_time 1.05 to 1.06)</bridgehead>
+ <informaltable frame="all">
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Type</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>Feature</entry>
+ <entry>
+ Added support for formatting and reading time durations longer than 24 hours.
+ A new formatter <code>%O</code> is used indicate such long durations in the
+ format string. The old <code>%H</code> format specifier is thus restricted
+ to represent durations that fit into two characters, in order to retain support
+ for reading durations in ISO format.
+ </entry>
+ </row>
+
+ <row>
+ <entry>Bug fix</entry>
+ <entry>
+ Added support for GCC 4.3. Several compilation issues were solved, as well as
+ compiler warnings were taken care of.
+ </entry>
+ </row>
+
+ <row>
+ <entry>Bug fix</entry>
+ <entry>
+ Added missing streaming operators for the <code>local_time_period</code> class.
+ </entry>
+ </row>
+
+ <row>
+ <entry>Bug fix</entry>
+ <entry>
+ Added several missing includes in different places. Some includes that are
+ not needed in some configurations were made conditional.
+ </entry>
+ </row>
+
+ <row>
+ <entry>Bug fix</entry>
+ <entry>
+ Solved compilation problem that was caused by not finding streaming operators
+ for <code>gregorian::date_duration</code> via ADL. The type is now made actually
+ a class rather a typedef for the <code>date_time::date_duration</code> template.
+ The similar change was done for <code>gregorian::weeks</code>.
+ </entry>
+ </row>
+
+ <row>
+ <entry>Bug fix</entry>
+ <entry>
+ Added a correctly spelled <code>date_time::hundredth</code> time resolution enum
+ value. The old one <code>date_time::hundreth</code> is considered deprecated and
+ to be removed in future releases.
+ </entry>
+ </row>
+
+ <row>
+ <entry>Bug fix</entry>
+ <entry>
+ Fixed compilation error in <code>format_date_parser.hpp</code> because of incorrect
+ stream type being used.
+ </entry>
+ </row>
+
+ <row>
+ <entry>Bug fix</entry>
+ <entry>
+ On Windows platform made inclusion of <code>windows.h</code> optional. The header is only used
+ when the <code>BOOST_USE_WINDOWS_H</code> macro is defined. Otherwise (and by default),
+ the library uses internal definitions of symbols from this header.
+ </entry>
+ </row>
+
+ <row>
+ <entry>Bug Fix</entry>
+ <entry>
+ </entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </informaltable>
+
+
+
   <bridgehead renderas="sect3">Changes from Boost 1.33 to 1.34 (date_time 1.04 to 1.05)</bridgehead>
   <informaltable frame="all">
     <tgroup cols="2">

Modified: trunk/libs/date_time/xmldoc/date_class.xml
==============================================================================
--- trunk/libs/date_time/xmldoc/date_class.xml (original)
+++ trunk/libs/date_time/xmldoc/date_class.xml 2008-11-01 06:36:57 EDT (Sat, 01 Nov 2008)
@@ -40,7 +40,7 @@
 
   <para>
     The construction of a date validates all input so that it is not possible to
- construct and 'invalid' date. That is 2001-Feb-29 cannot be constructed as a date.
+ construct an 'invalid' date. That is 2001-Feb-29 cannot be constructed as a date.
     Various exceptions derived from std::out_of_range are thrown to indicate which aspect
     of the date input is invalid. Note that the
     special value not-a-date-time can be used as 'invalid' or 'null' date if so desired.
@@ -230,7 +230,7 @@
         
         <row>
           <entry valign="top" morerows="1"><screen>greg_day_of_week day_of_week() const</screen></entry>
- <entry>Get the day of the week (eg: Sunday, Monday, etc.</entry>
+ <entry>Get the day of the week (Sunday, Monday, etc.)</entry>
         </row>
         <row>
           <entry><screen>date d(2002,Jan,10);
@@ -364,7 +364,7 @@
       <tbody>
         <row>
           <entry valign="top" morerows="1"><screen>std::string to_simple_string(date d)</screen></entry>
- <entry>To <code>YYYY-mmm-DD</code> string where <code>mmm</code> 3 char month name.</entry>
+ <entry>To <code>YYYY-mmm-DD</code> string where <code>mmm</code> is a 3 char month name.</entry>
         </row>
         <row>
           <entry><screen>"2002-Jan-01"</screen></entry>
@@ -447,7 +447,7 @@
         
         <row>
           <entry valign="top" morerows="1"><screen>date operator-(date_duration) const</screen></entry>
- <entry>Return a date by adding a day offset</entry>
+ <entry>Return a date by substracting a day offset</entry>
         </row>
         <row>
           <entry><screen>date d(2002,Jan,1);

Modified: trunk/libs/date_time/xmldoc/format_flags.xml
==============================================================================
--- trunk/libs/date_time/xmldoc/format_flags.xml (original)
+++ trunk/libs/date_time/xmldoc/format_flags.xml 2008-11-01 06:36:57 EDT (Sat, 01 Nov 2008)
@@ -301,6 +301,14 @@
           </row>
 
           <row>
+ <entry valign="top" morerows="1"><screen>%O</screen></entry>
+ <entry>The number of hours in a time duration as a decimal number (range 0 to max. representable duration); single digits are preceded by a zero.</entry>
+ </row>
+ <row>
+ <entry><screen></screen></entry>
+ </row>
+
+ <row>
             <entry valign="top" morerows="1"><screen>%I !</screen></entry>
             <entry>The hour as a decimal number using a 12-hour clock</entry>
           </row>

Modified: trunk/libs/date_time/xmldoc/gregorian.xml
==============================================================================
--- trunk/libs/date_time/xmldoc/gregorian.xml (original)
+++ trunk/libs/date_time/xmldoc/gregorian.xml 2008-11-01 06:36:57 EDT (Sat, 01 Nov 2008)
@@ -24,7 +24,7 @@
   </para>
   <para>All types for the gregorian system are found in namespace boost::gregorian. The library supports a convenience header boost/date_time/gregorian/gregorian_types.hpp that will include all the classes of the library with no input/output dependency. Another header boost/date_time/gregorian/gregorian.hpp will include the types and the input/output code.
   </para>
- <para>The class <link linkend="date_time.gregorian.date_class">boost::gregorian::date</link> is the primary temporal type for users. If you are interested in learning about writing programs do specialized date calculations such as finding the "first sunday in april" see the date <link linkend="date_time.gregorian.date_algorithms">generators and algorithms page</link>.
+ <para>The class <link linkend="date_time.gregorian.date_class">boost::gregorian::date</link> is the primary temporal type for users. If you are interested in learning about writing programs that do specialized date calculations such as finding the "first sunday in april" see the date <link linkend="date_time.gregorian.date_algorithms">generators and algorithms page</link>.
   </para>
 
   <anchor id="greg_ex" />

Modified: trunk/libs/date_time/xmldoc/snap_to_details.xml
==============================================================================
--- trunk/libs/date_time/xmldoc/snap_to_details.xml (original)
+++ trunk/libs/date_time/xmldoc/snap_to_details.xml 2008-11-01 06:36:57 EDT (Sat, 01 Nov 2008)
@@ -11,7 +11,7 @@
 <para>
 <anchor id="snap_to_details" />
 <bridgehead renderas="sect4">Reversibility of Operations Pitfall</bridgehead>
-<para>A natural expectation when adding a number of months to a date, and then subtracting the same number of months, is to end up exactly where you started. This is most often the result the <code>date_time</code> library provides but there is one significant exception: The snap-to-end-of-month behavior implemented by the <link linkend="additional_duration_types">months</link> duration type. The <link linkend="additional_duration_types">months</link> duration type may provide unexpected results when the starting day is the 28th, 29th, or 30th in a 31 day month. The <link linkend="iterators_intro">month_iterator</link> is not effected by this issue and is therefore included in the examples to illustrate a possible alternative.
+<para>A natural expectation when adding a number of months to a date, and then subtracting the same number of months, is to end up exactly where you started. This is most often the result the <code>date_time</code> library provides but there is one significant exception: The snap-to-end-of-month behavior implemented by the <link linkend="additional_duration_types">months</link> duration type. The <link linkend="additional_duration_types">months</link> duration type may provide unexpected results when the starting day is the 28th, 29th, or 30th in a 31 day month. The <link linkend="iterators_intro">month_iterator</link> is not affected by this issue and is therefore included in the examples to illustrate a possible alternative.
 </para>
 
 <para>When the starting date is in the middle of a month, adding or subtracting any number of months will result in a date that is the same day of month (e.g. if you start on the 15th, you will end on the 15th). When a date is the last day of the month, adding or subtracting any number of months will give a result that is also the last day of the month (e.g if you start on Jan 31st, you will land on: Feb 28th, Mar 31st, etc).
@@ -29,7 +29,7 @@
   </programlisting>
 </para>
 
-<para>If the start date is the 28th, 29th, or 30th in a 31 day month, the result of adding or subtracting a month may result in the snap-to-end-of-month behavior kicking in unexpectedly. This would cause the final result to be different that the starting date.
+<para>If the start date is the 28th, 29th, or 30th in a 31 day month, the result of adding or subtracting a month may result in the snap-to-end-of-month behavior kicking in unexpectedly. This would cause the final result to be different than the starting date.
   <programlisting>
     // using months duration type
     date d(2005, Nov, 29);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk