Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75651 - trunk/boost/chrono/io_v1
From: vicente.botet_at_[hidden]
Date: 2011-11-24 18:10:16


Author: viboes
Date: 2011-11-24 18:10:15 EST (Thu, 24 Nov 2011)
New Revision: 75651
URL: http://svn.boost.org/trac/boost/changeset/75651

Log:
Chrono: added traces to try to catch sun issue in time_point input
Text files modified:
   trunk/boost/chrono/io_v1/chrono_io.hpp | 40 +++++++++++++++++++++++++++++++++++++++-
   1 files changed, 39 insertions(+), 1 deletions(-)

Modified: trunk/boost/chrono/io_v1/chrono_io.hpp
==============================================================================
--- trunk/boost/chrono/io_v1/chrono_io.hpp (original)
+++ trunk/boost/chrono/io_v1/chrono_io.hpp 2011-11-24 18:10:15 EST (Thu, 24 Nov 2011)
@@ -265,45 +265,59 @@
 std::basic_istream<CharT, Traits>&
 operator>>(std::basic_istream<CharT, Traits>& is, duration<Rep, Period>& d)
 {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
     typedef duration_punct<CharT> Facet;
     std::locale loc = is.getloc();
- if (!std::has_facet<Facet>(loc))
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
+ if (!std::has_facet<Facet>(loc)) {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         is.imbue(std::locale(loc, new Facet));
+ }
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
     loc = is.getloc();
     const Facet& f = std::use_facet<Facet>(loc);
     typedef typename chrono_detail::duration_io_intermediate<Rep>::type intermediate_type;
     intermediate_type r;
     std::ios_base::iostate err = std::ios_base::goodbit;
     // read value into r
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
     is >> r;
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
     if (is.good())
     {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         // now determine unit
         typedef std::istreambuf_iterator<CharT, Traits> in_iterator;
         in_iterator i(is);
         in_iterator e;
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         if (i != e && *i == ' ') // mandatory ' ' after value
         {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
             ++i;
             if (i != e)
             {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 // unit is num / den (yet to be determined)
                 unsigned long long num = 0;
                 unsigned long long den = 0;
                 if (*i == '[')
                 {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     // parse [N/D]s or [N/D]seconds format
                     ++i;
                     CharT x;
                     is >> num >> x >> den;
                     if (!is.good() || (x != '/'))
                     {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                         is.setstate(is.failbit);
                         return is;
                     }
                     i = in_iterator(is);
                     if (*i != ']')
                     {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                         is.setstate(is.failbit);
                         return is;
                     }
@@ -314,22 +328,27 @@
                         f.template plural<ratio<1> >(),
                         f.template short_name<ratio<1> >()
                     };
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     const std::basic_string<CharT>* k = chrono_detail::scan_keyword(i, e,
                                   units, units + sizeof(units)/sizeof(units[0]),
                                   //~ std::use_facet<std::ctype<CharT> >(loc),
                                   err);
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     is.setstate(err);
                     switch ((k - units) / 3)
                     {
                     case 0:
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                         break;
                     default:
                         is.setstate(err);
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                         return is;
                     }
                 }
                 else
                 {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     // parse SI name, short or long
                     const std::basic_string<CharT> units[] =
                     {
@@ -391,10 +410,12 @@
                         f.template plural<ratio<3600> >(),
                         f.template short_name<ratio<3600> >()
                     };
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     const std::basic_string<CharT>* k = chrono_detail::scan_keyword(i, e,
                                   units, units + sizeof(units)/sizeof(units[0]),
                                   //~ std::use_facet<std::ctype<CharT> >(loc),
                                   err);
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     switch ((k - units) / 3)
                     {
                     case 0:
@@ -474,10 +495,12 @@
                         den = 1;
                         break;
                     default:
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                         is.setstate(err|is.failbit);
                         return is;
                     }
                 }
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 // unit is num/den
                 // r should be multiplied by (num/den) / Period
                 // Reduce (num/den) / Period to lowest terms
@@ -490,6 +513,7 @@
                 if (num > (std::numeric_limits<unsigned long long>::max)() / d2 ||
                     den > (std::numeric_limits<unsigned long long>::max)() / n2)
                 {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     // (num/den) / Period overflows
                     is.setstate(err|is.failbit);
                     return is;
@@ -499,54 +523,68 @@
 
                 typedef typename common_type<intermediate_type, unsigned long long>::type common_type_t;
 
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 // num / den is now factor to multiply by r
                 if (!chrono_detail::reduce(r, den, err))
                 {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                   is.setstate(err|is.failbit);
                   return is;
                 }
 
                 //if (r > ((duration_values<common_type_t>::max)() / num))
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 if (chrono::detail::gt(r,((duration_values<common_type_t>::max)() / num)))
                 {
                     // Conversion to Period overflowed
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     is.setstate(err|is.failbit);
                     return is;
                 }
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 common_type_t t = r * num;
                 t /= den;
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
 
                 if (t > 0)
                 {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                   Rep pt = t;
                   if ( (duration_values<Rep>::max)() < pt)
                   {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                     // Conversion to Period overflowed
                     is.setstate(err|is.failbit);
                     return is;
                   }
                 }
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 // Success! Store it.
                 r = Rep(t);
                 d = duration<Rep, Period>(r);
                 is.setstate(err);
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 return is;
             }
             else {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
                 is.setstate(is.failbit | is.eofbit);
                 return is;
             }
         }
         else
         {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
             if (i == e)
               is.setstate(is.failbit|is.eofbit);
             else
               is.setstate(is.failbit);
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
             return is;
         }
     }
     else {
+ std::cerr << __FILE__ << "[" << __LINE__ << "]"<< std::endl;
         //is.setstate(is.failbit);
       return is;
     }


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