$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r84372 - in sandbox/chrono_date: boost/chrono/date libs/date/perf libs/date/src
From: vicente.botet_at_[hidden]
Date: 2013-05-19 09:13:47
Author: viboes
Date: 2013-05-19 09:13:46 EDT (Sun, 19 May 2013)
New Revision: 84372
URL: http://svn.boost.org/trac/boost/changeset/84372
Log:
Chrono/Date: add constexpr for month_day and comment some dead code on rel_date.
Text files modified: 
   sandbox/chrono_date/boost/chrono/date/tuples.hpp                   |    73 +++++++-                                
   sandbox/chrono_date/boost/chrono/date/ymd_date.hpp                 |    20 +-                                      
   sandbox/chrono_date/libs/date/perf/serial_calendar_conversions.cpp |   357 +++++++++++++++++++++++++++++++-------- 
   sandbox/chrono_date/libs/date/src/rel_date.cpp                     |   154 ++++++++--------                        
   4 files changed, 435 insertions(+), 169 deletions(-)
Modified: sandbox/chrono_date/boost/chrono/date/tuples.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/tuples.hpp	(original)
+++ sandbox/chrono_date/boost/chrono/date/tuples.hpp	2013-05-19 09:13:46 EDT (Sun, 19 May 2013)
@@ -397,6 +397,12 @@
       {
         month m_;
         day d_;
+
+        BOOST_FORCEINLINE static BOOST_CHRONO_DATE_CONSTEXPR
+        bool is_valid_(month m, day d)
+        {
+            return (d<=m.days_in(true).count());
+        }
       public:
         BOOST_FORCEINLINE BOOST_CONSTEXPR month_day(month m, day d) BOOST_NOEXCEPT
         : m_(m),
@@ -421,6 +427,15 @@
         {
           return d_;
         }
+        /**
+         *
+         * @Returns whether the @c month()/day() is a valid proleptic Gregorian date.
+         */
+        // @todo BOOST_CONSTEXPR
+        BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR bool is_valid() const BOOST_NOEXCEPT
+        {
+          return month(m_).is_valid() && day(d_).is_valid() && is_valid_(month(m_), day(d_));
+        }
       };
 
       BOOST_FORCEINLINE BOOST_CONSTEXPR month_day operator/(month m, day d) BOOST_NOEXCEPT
@@ -463,16 +478,40 @@
     {
       month m_;
       day d_;
+
+      BOOST_FORCEINLINE static BOOST_CHRONO_DATE_CONSTEXPR
+      bool is_valid_(month m, day d)
+      {
+          return (d<=m.days_in(true).count());
+      }
+
+#ifndef  BOOST_NO_CXX11_CONSTEXPR
+      BOOST_FORCEINLINE static BOOST_CHRONO_DATE_CONSTEXPR
+      day check_invariants(month m, day d)
+      {
+          return is_valid_(m,d)
+                  ? d
+                  : throw bad_date("day " + to_string(d) + " is out of range for month " + to_string(m))
+                ;
+      }
+#else
+      BOOST_FORCEINLINE static
+      day check_invariants(month m, day d)
+      {
+          if ( is_valid_(m,d) )
+              return d;
+          else throw bad_date("day " + to_string(d) + " is out of range for month " + to_string(m));
+      }
+#endif
     public:
-      BOOST_FORCEINLINE BOOST_CONSTEXPR month_day(month m, day d)BOOST_NOEXCEPT
+      BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR month_day(month m, day d)
       : m_(m),
-      d_(d)
+      d_(check_invariants(m,d))
       {
-        // check validity of day relative to month.
       }
-      BOOST_FORCEINLINE BOOST_CONSTEXPR month_day(month::rep m, day::rep d, check_t)
+      BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR month_day(month::rep m, day::rep d, check_t)
       : m_(m),
-      d_(d)
+      d_(check_invariants(month(m),day(d)))
       {
       }
 
@@ -482,9 +521,11 @@
       {
       }
 
-      BOOST_FORCEINLINE BOOST_CONSTEXPR explicit month_day(unchecked::month_day md)
-          : m_(unchecked::month(md)),
-          d_(unchecked::day(md))
+      // conversions
+
+      BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR explicit month_day(unchecked::month_day md)
+          : m_(unchecked::month(md),no_check),
+          d_(check_invariants(month(unchecked::month(md)), day(unchecked::day(md))))
       {
       }
 
@@ -493,6 +534,7 @@
         return unchecked::month_day(m_, d_);
       }
 
+      // Observers
       /**
        * @Return the month stored component.
        */
@@ -509,15 +551,26 @@
       {
         return d_;
       }
+
+      /**
+       *
+       * @Returns whether the @c month()/day() is a valid proleptic Gregorian date.
+       */
+      // @todo BOOST_CONSTEXPR
+      BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_valid() const BOOST_NOEXCEPT
+      {
+        //return month(m_).is_valid() && day(d_).is_valid() && is_valid_(year(y_), month(m_), day(d_));
+        return true;
+      }
     };
 
-    BOOST_FORCEINLINE BOOST_CONSTEXPR month_day operator/(month m, day d) BOOST_NOEXCEPT
+    BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR month_day operator/(month m, day d) BOOST_NOEXCEPT
     {
       return month_day(m, d);
     }
 
 
-    BOOST_FORCEINLINE BOOST_CONSTEXPR month_day operator/(day d, month m) BOOST_NOEXCEPT
+    BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR month_day operator/(day d, month m) BOOST_NOEXCEPT
     {
       return month_day(m, d);
     }
Modified: sandbox/chrono_date/boost/chrono/date/ymd_date.hpp
==============================================================================
--- sandbox/chrono_date/boost/chrono/date/ymd_date.hpp	(original)
+++ sandbox/chrono_date/boost/chrono/date/ymd_date.hpp	2013-05-19 09:13:46 EDT (Sun, 19 May 2013)
@@ -189,6 +189,7 @@
   #endif
         {
         }
+
         /**
          * @Effects @c tp is converted to UTC, and then truncated to 00:00:00 hours.
          * A ymd_date is created which reflects this point in time.
@@ -465,11 +466,11 @@
           return *this += years(-y.count());
         }
 
-        friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator==(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT;
-        friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator< (const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT;
 
   #if ! defined  BOOST_CHRONO_DATE_DOXYGEN_INVOKED
       private:
+        friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator==(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT;
+        friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator< (const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT;
 
         days::rep day_number_from_ymd() const BOOST_NOEXCEPT;
   #endif
@@ -721,7 +722,7 @@
       BOOST_FORCEINLINE static BOOST_CHRONO_DATE_CONSTEXPR
       bool is_valid_(year_month ym, day d)
       {
-          return d < ym.days_in().count();
+          return d <= ym.days_in().count();
       }
 
 #ifndef  BOOST_NO_CXX11_CONSTEXPR
@@ -968,9 +969,10 @@
        * @Returns whether the @c year()/month()/day() is a valid proleptic Gregorian date.
        */
       // @todo BOOST_CONSTEXPR
-      BOOST_FORCEINLINE BOOST_CHRONO_DATE_CONSTEXPR bool is_valid() const BOOST_NOEXCEPT
+      BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_valid() const BOOST_NOEXCEPT
       {
-        return month(m_).is_valid() && unchecked::day(d_).is_valid() && is_valid_(year(y_), month(m_), day(d_, no_check));
+        //return month(m_).is_valid() && unchecked::day(d_).is_valid() && is_valid_(year(y_), month(m_), day(d_, no_check));
+        return true;
       }
 
 //#if ! defined  BOOST_CHRONO_DATE_DOXYGEN_INVOKED
@@ -1058,7 +1060,7 @@
       }
       BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::month_day() const BOOST_NOEXCEPT
       {
-        return chrono::month_day(chrono::month(m_, no_check), chrono::day(d_, no_check));
+        return chrono::month_day(chrono::month(m_, no_check), chrono::day(d_, no_check), no_check);
       }
       BOOST_FORCEINLINE BOOST_CONSTEXPR operator chrono::year_month() const BOOST_NOEXCEPT
       {
@@ -1240,12 +1242,10 @@
         return *this += years(-y.count());
       }
 
-      friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator==(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT;
-      friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator< (const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT;
-
-
 #if ! defined  BOOST_CHRONO_DATE_DOXYGEN_INVOKED
     private:
+      friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator==(const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT;
+      friend BOOST_FORCEINLINE BOOST_CONSTEXPR bool operator< (const ymd_date& x, const ymd_date& y) BOOST_NOEXCEPT;
 
       days::rep day_number_from_ymd() const BOOST_NOEXCEPT;
 #endif
Modified: sandbox/chrono_date/libs/date/perf/serial_calendar_conversions.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/perf/serial_calendar_conversions.cpp	(original)
+++ sandbox/chrono_date/libs/date/perf/serial_calendar_conversions.cpp	2013-05-19 09:13:46 EDT (Sun, 19 May 2013)
@@ -8,19 +8,14 @@
 
 using namespace boost::chrono;
 const int Ymin = 1900;
-const int Ymax = 2100;
+const int Ymax = 4100;
 volatile int y;
 volatile int m;
 volatile int d;
 volatile boost::int_least16_t m16;
 volatile boost::int_least16_t d16;
 
-//#define VOLATILE
-//#define CHECK_IS_VALID(d) if(d.is_valid())
-
-#define VOLATILE volatile
-#define CHECK_IS_VALID(d)
-
+#if 0
 void empty_unchecked_ymd_dcl()
 {
   int count = 0;
@@ -34,12 +29,73 @@
       int last = unchecked::month(m).days_in(is_l).count();
       for (int d = 1; d <= last; ++d)
       {
-        unchecked::ymd_date dt=unchecked::ymd_date(
-            year(y),
+        unchecked::ymd_date dt;
+        ycount+= unchecked::day(dt);
+        ++count;
+      }
+    }
+  }
+  auto t1 = boost::chrono::high_resolution_clock::now();
+  typedef boost::chrono::duration<float, boost::nano> sec;
+  auto encode = t1 - t0;
+  std::cout << "default unchecked calendar " << sec(encode).count() / count << " " << ycount << '\n';
+}
+
+void empty_checked_ymd_dcl()
+{
+  int count = 0;
+  int ycount = 0;
+  auto t0 = boost::chrono::high_resolution_clock::now();
+  for (int y = Ymin; y <= Ymax; ++y)
+  {
+    bool is_l = year(y).is_leap();
+    for (int m = 1; m <= 12; ++m)
+    {
+      int last = unchecked::month(m).days_in(is_l).count();
+      for (int d = 1; d <= last; ++d)
+      {
+        ymd_date dt;
+        ycount+= day(dt);
+        ++count;
+      }
+    }
+  }
+  auto t1 = boost::chrono::high_resolution_clock::now();
+  typedef boost::chrono::duration<float, boost::nano> sec;
+  auto encode = t1 - t0;
+  std::cout << "default checked calendar   " << sec(encode).count() / count << " " << ycount << '\n';
+}
+#endif
+void unchecked_ymd_dcl()
+{
+  int count = 0;
+  int ycount = 0;
+  auto t0 = boost::chrono::high_resolution_clock::now();
+  for (int y = Ymin; y <= Ymax; ++y)
+  {
+    bool is_l = year(y).is_leap();
+    for (int m = 1; m <= 12; ++m)
+    {
+      int last = unchecked::month(m).days_in(is_l).count();
+      for (int d = 1; d <= last; ++d)
+      {
+#if 1
+        unchecked::ymd_date dt(
+            (year(y)),
             unchecked::month(m),
             unchecked::day(d)
         );
-        ycount+= unchecked::day(dt);
+        ycount+= unchecked::day(dt)+unchecked::month(dt)+year(dt);
+#else
+        //ymd_date dt((year(y)), month(m), day(d));
+        //ymd_date dt((year(y)), month(m), day(d, no_check));
+        //ymd_date dt((year(y)), month(m, no_check), day(d));
+        //ymd_date dt((year(y)), month(m, no_check), day(d, no_check));
+        //ymd_date dt((year(y)), month(m, no_check), day(d, no_check), no_check);
+        ymd_date dt((year(y)), month_day(month(m, no_check), day(d, no_check), no_check));
+        //ymd_date dt((year_month(year(y), month(m, no_check))), day(d, no_check));
+        ycount+= day(dt)+month(dt)+year(dt);
+#endif
         ++count;
       }
     }
@@ -49,7 +105,9 @@
   auto encode = t1 - t0;
   std::cout << "unchecked calendar " << sec(encode).count() / count << " " << ycount << '\n';
 }
-void empty_checked_ymd_dcl()
+#if 0
+
+void checked_month_ymd_dcl()
 {
   int count = 0;
   int ycount = 0;
@@ -59,10 +117,64 @@
     bool is_l = year(y).is_leap();
     for (int m = 1; m <= 12; ++m)
     {
-      int last = month(m).days_in(is_l).count();
+      int last = unchecked::month(m).days_in(is_l).count();
+      for (int d = 1; d <= last; ++d)
+      {
+        ymd_date dt((year(y)), month(m), day(d));
+        //ymd_date dt((year(y)), month(m), day(d, no_check));
+        //ymd_date dt((year(y)), month(m, no_check), day(d));
+        //ymd_date dt((year(y)), month(m, no_check), day(d, no_check));
+        ycount+= day(dt);
+        ++count;
+      }
+    }
+  }
+  auto t1 = boost::chrono::high_resolution_clock::now();
+  typedef boost::chrono::duration<float, boost::nano> sec;
+  auto encode = t1 - t0;
+  std::cout << "checked month calendar   " << sec(encode).count() / count << " " << ycount << '\n';
+}
+void checked_ymd_dcl()
+{
+  int count = 0;
+  int ycount = 0;
+  auto t0 = boost::chrono::high_resolution_clock::now();
+  for (int y = Ymin; y <= Ymax; ++y)
+  {
+    bool is_l = year(y).is_leap();
+    for (int m = 1; m <= 12; ++m)
+    {
+      int last = unchecked::month(m).days_in(is_l).count();
+      for (int d = 1; d <= last; ++d)
+      {
+        ymd_date dt((year(y)), month(m), day(d));
+        ycount+= day(dt);
+        ++count;
+      }
+    }
+  }
+  auto t1 = boost::chrono::high_resolution_clock::now();
+  typedef boost::chrono::duration<float, boost::nano> sec;
+  auto encode = t1 - t0;
+  std::cout << "checked month/day calendar   " << sec(encode).count() / count << " " << ycount << '\n';
+}
+void checked_day_ymd_dcl()
+{
+  int count = 0;
+  int ycount = 0;
+  auto t0 = boost::chrono::high_resolution_clock::now();
+  for (int y = Ymin; y <= Ymax; ++y)
+  {
+    bool is_l = year(y).is_leap();
+    for (int m = 1; m <= 12; ++m)
+    {
+      int last = unchecked::month(m).days_in(is_l).count();
+      //month pm(m, no_check);
       for (int d = 1; d <= last; ++d)
       {
-        ymd_date dt = ymd_date(year(y), month(m), day(d));
+        //ymd_date dt((year(y)), month(m, no_check), day(d));
+        ymd_date dt((year(y)), month(m), day(d));
+        //ymd_date dt((year(y)), pm, day(d));
         ycount+= day(dt);
         ++count;
       }
@@ -71,10 +183,10 @@
   auto t1 = boost::chrono::high_resolution_clock::now();
   typedef boost::chrono::duration<float, boost::nano> sec;
   auto encode = t1 - t0;
-  std::cout << "checked calendar   " << sec(encode).count() / count << " " << ycount << '\n';
+  std::cout << "checked day calendar   " << sec(encode).count() / count << " " << ycount << '\n';
 }
 
-void empty_encoding_perf()
+void checked_unchecked_ymd_dcl()
 {
   int count = 0;
   int ycount = 0;
@@ -84,10 +196,38 @@
     bool is_l = year(y).is_leap();
     for (int m = 1; m <= 12; ++m)
     {
-      int last = month(m).days_in(is_l).count();
+      int last = unchecked::month(m).days_in(is_l).count();
+      for (int d = 1; d <= last; ++d)
+      {
+        ymd_date dt((year(y)), month(m), day(d));
+        unchecked::ymd_date dt2 = dt;
+        ycount+= unchecked::day(dt2);
+        ++count;
+      }
+    }
+  }
+  auto t1 = boost::chrono::high_resolution_clock::now();
+  typedef boost::chrono::duration<float, boost::nano> sec;
+  auto encode = t1 - t0;
+  std::cout << "calendar -> unchecked calendar " << sec(encode).count() / count << " " << ycount << '\n';
+}
+
+void unchecked_checked_ymd_dcl()
+{
+  int count = 0;
+  int ycount = 0;
+  auto t0 = boost::chrono::high_resolution_clock::now();
+  for (int y = Ymin; y <= Ymax; ++y)
+  {
+    bool is_l = year(y).is_leap();
+    for (int m = 1; m <= 12; ++m)
+    {
+      int last = unchecked::month(m).days_in(is_l).count();
       for (int d = 1; d <= last; ++d)
       {
-        ycount+= d;
+        unchecked::ymd_date dt((year(y)), unchecked::month(m), unchecked::day(d));
+        ymd_date dt2(dt);
+        ycount+= day(dt2);
         ++count;
       }
     }
@@ -95,7 +235,7 @@
   auto t1 = boost::chrono::high_resolution_clock::now();
   typedef boost::chrono::duration<float, boost::nano> sec;
   auto encode = t1 - t0;
-  std::cout << "ymd empty loop     " << sec(encode).count() / count << " " << ycount << '\n';
+  std::cout << "unchecked calendar -> calendar " << sec(encode).count() / count << " " << ycount << '\n';
 }
 
 void raw_encoding_perf()
@@ -394,63 +534,136 @@
   auto encode = t1 - t0;
   std::cout << "unchecked calendar -> serial -> unchecked calendar " << sec(encode).count() / count << " " << ycount <<" " << count <<" " << y2count << '\n';
 }
+#endif
 
 int main()
 {
-  empty_encoding_perf();
-  empty_checked_ymd_dcl();
-  empty_unchecked_ymd_dcl();
-  empty_encoding_perf();
-  raw_encoding_perf();
-  raw_space_encoding_perf();
-  class_encoding_perf();
-  empty_decoding_perf();
-  raw_decoding_perf();
-  raw_space_decoding_perf();
-  class_decoding_perf();
-  class_decoding_encoding_perf();
-  unchecked_class_decoding_perf();
-  unchecked_class_decoding_encoding_perf();
-  class_decoding_perf();
-  class_decoding_encoding_perf();
-
-  empty_encoding_perf();
-  empty_checked_ymd_dcl();
-  empty_unchecked_ymd_dcl();
-  empty_encoding_perf();
-  raw_encoding_perf();
-  raw_space_encoding_perf();
-  class_encoding_perf();
-  empty_decoding_perf();
-  raw_decoding_perf();
-  raw_space_decoding_perf();
-  class_decoding_perf();
-  class_decoding_encoding_perf();
-  unchecked_class_decoding_perf();
-  unchecked_class_decoding_encoding_perf();
-  class_decoding_perf();
-  class_decoding_encoding_perf();
-  class_decoding_encoding_perf();
-  class_decoding_encoding_perf();
-  class_decoding_encoding_perf();
-  class_decoding_encoding_perf();
-  unchecked_class_decoding_encoding_perf();
-  unchecked_class_decoding_encoding_perf();
-  unchecked_class_decoding_encoding_perf();
-  unchecked_class_decoding_encoding_perf();
-  unchecked_class_decoding_encoding_perf();
-  unchecked_class_decoding_encoding_perf();
-
-  class_encoding_decoding_perf();
-  class_encoding_decoding_perf();
-  class_encoding_decoding_perf();
-  class_encoding_decoding_perf();
-  class_encoding_decoding_perf();
-  unchecked_class_encoding_decoding_perf();
-  unchecked_class_encoding_decoding_perf();
-  unchecked_class_encoding_decoding_perf();
-  unchecked_class_encoding_decoding_perf();
-  unchecked_class_encoding_decoding_perf();
+//  empty_checked_ymd_dcl();
+//  empty_checked_ymd_dcl();
+//  empty_checked_ymd_dcl();
+//  empty_checked_ymd_dcl();
+//  empty_checked_ymd_dcl();
+//  empty_unchecked_ymd_dcl();
+//  empty_unchecked_ymd_dcl();
+//  empty_unchecked_ymd_dcl();
+//  empty_unchecked_ymd_dcl();
+//  empty_unchecked_ymd_dcl();
+//  checked_day_ymd_dcl();
+//  checked_day_ymd_dcl();
+//  checked_day_ymd_dcl();
+//  checked_day_ymd_dcl();
+//  checked_day_ymd_dcl();
+//  checked_ymd_dcl();
+//  checked_ymd_dcl();
+//  checked_ymd_dcl();
+//  checked_ymd_dcl();
+//  checked_ymd_dcl();
+//  checked_ymd_dcl();
+//  checked_ymd_dcl();
+//  checked_ymd_dcl();
+//  checked_ymd_dcl();
+//  checked_ymd_dcl();
+//  checked_day_ymd_dcl();
+//  checked_day_ymd_dcl();
+//  checked_day_ymd_dcl();
+//  checked_day_ymd_dcl();
+//  checked_day_ymd_dcl();
+//  checked_month_ymd_dcl();
+//  checked_month_ymd_dcl();
+//  checked_month_ymd_dcl();
+//  checked_month_ymd_dcl();
+//  checked_month_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+  unchecked_ymd_dcl();
+//  checked_unchecked_ymd_dcl();
+//  checked_unchecked_ymd_dcl();
+//  checked_unchecked_ymd_dcl();
+//  checked_unchecked_ymd_dcl();
+//  checked_unchecked_ymd_dcl();
+//  unchecked_checked_ymd_dcl();
+//  unchecked_checked_ymd_dcl();
+//  unchecked_checked_ymd_dcl();
+//  unchecked_checked_ymd_dcl();
+//  unchecked_checked_ymd_dcl();
+//  empty_checked_ymd_dcl();
+//  empty_unchecked_ymd_dcl();
+//  checked_ymd_dcl();
+//  unchecked_ymd_dcl();
+//  checked_unchecked_ymd_dcl();
+//  raw_encoding_perf();
+//  raw_space_encoding_perf();
+//  class_encoding_perf();
+//  empty_decoding_perf();
+//  raw_decoding_perf();
+//  raw_space_decoding_perf();
+//  class_decoding_perf();
+//  class_decoding_encoding_perf();
+//  unchecked_class_decoding_perf();
+//  unchecked_class_decoding_encoding_perf();
+//  class_decoding_perf();
+//  class_decoding_encoding_perf();
+//
+//  empty_checked_ymd_dcl();
+//  empty_unchecked_ymd_dcl();
+//  checked_ymd_dcl();
+//  unchecked_ymd_dcl();
+//  checked_unchecked_ymd_dcl();
+//  empty_checked_ymd_dcl();
+//  empty_unchecked_ymd_dcl();
+//  checked_ymd_dcl();
+//  unchecked_ymd_dcl();
+//  checked_unchecked_ymd_dcl();
+//  raw_encoding_perf();
+//  raw_space_encoding_perf();
+//  class_encoding_perf();
+//  empty_decoding_perf();
+//  raw_decoding_perf();
+//  raw_space_decoding_perf();
+//  class_decoding_perf();
+//  class_decoding_encoding_perf();
+//  unchecked_class_decoding_perf();
+//  unchecked_class_decoding_encoding_perf();
+//  class_decoding_perf();
+//  class_decoding_encoding_perf();
+//  class_decoding_encoding_perf();
+//  class_decoding_encoding_perf();
+//  class_decoding_encoding_perf();
+//  class_decoding_encoding_perf();
+//  unchecked_class_decoding_encoding_perf();
+//  unchecked_class_decoding_encoding_perf();
+//  unchecked_class_decoding_encoding_perf();
+//  unchecked_class_decoding_encoding_perf();
+//  unchecked_class_decoding_encoding_perf();
+//  unchecked_class_decoding_encoding_perf();
+//
+//  class_encoding_decoding_perf();
+//  class_encoding_decoding_perf();
+//  class_encoding_decoding_perf();
+//  class_encoding_decoding_perf();
+//  class_encoding_decoding_perf();
+//  unchecked_class_encoding_decoding_perf();
+//  unchecked_class_encoding_decoding_perf();
+//  unchecked_class_encoding_decoding_perf();
+//  unchecked_class_encoding_decoding_perf();
+//  unchecked_class_encoding_decoding_perf();
   return 1;
 }
 
Modified: sandbox/chrono_date/libs/date/src/rel_date.cpp
==============================================================================
--- sandbox/chrono_date/libs/date/src/rel_date.cpp	(original)
+++ sandbox/chrono_date/libs/date/src/rel_date.cpp	2013-05-19 09:13:46 EDT (Sun, 19 May 2013)
@@ -686,7 +686,7 @@
     m_(m.value()),
     dow_(weekday(d)),
     d_(0),
-    n_(d.nth_weekday())
+    n_(nth_week(d))
     {
       leap_ = chrono::year(y_).is_leap();
       const day_of_year::rep* year_data = days_in_year_before(leap_);
@@ -763,7 +763,7 @@
 #elif BOOST_CHRONO_DATE_REL_DATE_DESIGN == 2
 
     rel_date::rel_date(year y, chrono::month m, nth_weekday nwd) :
-      n_(nwd.nth_weekday()), dow_(weekday(nwd))
+      n_(nth_week(nwd)), dow_(weekday(nwd))
     {
       bool leap = y.is_leap();
       const day_of_year::rep* year_data = days_in_year_before(leap);
@@ -862,25 +862,25 @@
 
       leap_ = chrono::year(y).is_leap();
       const day_of_year::rep* year_data = days_in_year_before(leap_);
-      if (n_ != nth_week::not_applicable) // if a nth is involved
+//      if (n_ != nth_week::not_applicable) // if a nth is involved
 
       {
-        if (dow_ == weekday::not_applicable) // if we want nth day of month
-
-        {
-          if (n_ == last.value_) // want last day of month
-
-          {
-            d_ = year_data[m_] - year_data[m_-1];
-            std::cout <<"  =========== d= "<< int(d_) << std::endl;
-          }
-          else
-          {
-            d_ = n_; // want nth day of month
-            std::cout <<"   =========== d= "<< int(d_) << std::endl;
-          }
-        }
-        else // we want nth weekday of month
+//        if (dow_ == weekday::not_applicable) // if we want nth day of month
+//
+//        {
+//          if (n_ == last.value_) // want last day of month
+//
+//          {
+//            d_ = year_data[m_] - year_data[m_-1];
+//            std::cout <<"  =========== d= "<< int(d_) << std::endl;
+//          }
+//          else
+//          {
+//            d_ = n_; // want nth day of month
+//            std::cout <<"   =========== d= "<< int(d_) << std::endl;
+//          }
+//        }
+//        else // we want nth weekday of month
 
         {
           // dow_ = [0 - 5] 0 means last
@@ -925,13 +925,13 @@
           std::cout <<"    =========== d= "<< int(d_) << std::endl;
         }
       }
-      if (!(1 <= d_ && d_ <= year_data[m_] - year_data[m_-1]))
-      {
-        std::cout <<"===== ====== d= "<< int(d_) << std::endl;
-        throw bad_date("day " + to_string(int(d_)) +
-            " is out of range for " + to_string(y_) +
-            '-' + to_string(int(m_)));
-      }
+//      if (!(1 <= d_ && d_ <= year_data[m_] - year_data[m_-1]))
+//      {
+//        std::cout <<"===== ====== d= "<< int(d_) << std::endl;
+//        throw bad_date("day " + to_string(int(d_)) +
+//            " is out of range for " + to_string(y_) +
+//            '-' + to_string(int(m_)));
+//      }
     }
 
 #endif
@@ -1117,10 +1117,10 @@
     {
       leap_ = y.is_leap();
       const day_of_year::rep* year_data = days_in_year_before(leap_);
-      if (n_ != nth_week::not_applicable) // if a nth is involved
+//      if (n_ != nth_week::not_applicable) // if a nth is involved
 
       {
-        if (dow_ == weekday::not_applicable) // if we want nth day of month
+//        if (dow_ == weekday::not_applicable) // if we want nth day of month
 
         {
           if (n_ == last.value_) // want last day of month
@@ -1133,56 +1133,56 @@
             d_ = n_; // want nth day of month
           }
         }
-        else // we want nth weekday of month
-
-        {
-          // dow_ = [0 - 6]
-          // n_ = [1 - 6] 6 means last
-          int32_t by = y.value() + 32799;
-          int32_t fy = by*365 + by/4 - by/100 + by/400;
-          int n_days_in_month = year_data[m_] - year_data[m_-1];
-          int d;
-          if (n_ == last.value_)
-          {
-            int ldow = (fy + year_data[m_] + 1) % weekday::size;
-            d = n_days_in_month;
-            if (dow_ < ldow)
-            {
-              d -= ldow - dow_;
-            }
-            else if (dow_ > ldow)
-            {
-              d -= weekday::size - (dow_ - ldow);
-            }
-          }
-          else
-          {
-            int fdow = (fy + year_data[m_-1] + 2) % weekday::size;
-            d = 1 + (n_-1) * weekday::size;
-            if (dow_ < fdow)
-            {
-              d += weekday::size - (fdow - dow_);
-            }
-            else if (dow_ > fdow)
-            {
-              d += dow_ - fdow;
-            }
-            if (d > n_days_in_month)
-            {
-              throw bad_date("day " + to_string(int(d)) +
-                  " is out of range for " + to_string(y_) +
-                  '-' + to_string(int(m_)));
-            }
-          }
-          d_ = d;
-        }
-      }
-      if (!(1 <= d_ && d_ <= year_data[m_] - year_data[m_-1]))
-      {
-        throw bad_date("day " + to_string(int(d_)) +
-            " is out of range for " + to_string(y_) +
-            '-' + to_string(int(m_)));
+//        else // we want nth weekday of month
+//
+//        {
+//          // dow_ = [0 - 6]
+//          // n_ = [1 - 6] 6 means last
+//          int32_t by = y.value() + 32799;
+//          int32_t fy = by*365 + by/4 - by/100 + by/400;
+//          int n_days_in_month = year_data[m_] - year_data[m_-1];
+//          int d;
+//          if (n_ == last.value_)
+//          {
+//            int ldow = (fy + year_data[m_] + 1) % weekday::size;
+//            d = n_days_in_month;
+//            if (dow_ < ldow)
+//            {
+//              d -= ldow - dow_;
+//            }
+//            else if (dow_ > ldow)
+//            {
+//              d -= weekday::size - (dow_ - ldow);
+//            }
+//          }
+//          else
+//          {
+//            int fdow = (fy + year_data[m_-1] + 2) % weekday::size;
+//            d = 1 + (n_-1) * weekday::size;
+//            if (dow_ < fdow)
+//            {
+//              d += weekday::size - (fdow - dow_);
+//            }
+//            else if (dow_ > fdow)
+//            {
+//              d += dow_ - fdow;
+//            }
+//            if (d > n_days_in_month)
+//            {
+//              throw bad_date("day " + to_string(int(d)) +
+//                  " is out of range for " + to_string(y_) +
+//                  '-' + to_string(int(m_)));
+//            }
+//          }
+//          d_ = d;
+//        }
       }
+//      if (!(1 <= d_ && d_ <= year_data[m_] - year_data[m_-1]))
+//      {
+//        throw bad_date("day " + to_string(int(d_)) +
+//            " is out of range for " + to_string(y_) +
+//            '-' + to_string(int(m_)));
+//      }
     }
 
 #endif