[Boost-bugs] [Boost C++ Libraries] #12449: date_time from string throws exception if time not set

Subject: [Boost-bugs] [Boost C++ Libraries] #12449: date_time from string throws exception if time not set
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-09-12 11:37:48


#12449: date_time from string throws exception if time not set
--------------------------------+------------------------
 Reporter: peter.kirchweger@… | Owner: az_sw_dude
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: date_time
  Version: Boost 1.61.0 | Severity: Problem
 Keywords: |
--------------------------------+------------------------
 There was a bug in parse_iso_time of date_time\time_parsing.hpp in earlier
 versions of boost. This has been fixed, but the fix does not work if just
 a date is given (no time set).
 This is not what I would expect, I would like to get a time set to
 midnight.
 My suggestion is to update the fix in split() from


 {{{
   //! Utility function to split appart string
   inline bool
   split(const std::string& s,
         char sep,
         std::string& first,
         std::string& second)
   {
     std::string::size_type sep_pos = s.find(sep);
     first = s.substr(0,sep_pos);
     if (sep_pos!=std::string::npos)
         second = s.substr(sep_pos+1);
     return true;
   }
 }}}


 to


 {{{
   //! Utility function to split appart string
   inline bool
   split(const std::string& s,
         char sep,
         std::string& first,
         std::string& second)
   {
     std::string::size_type sep_pos = s.find(sep);
     first = s.substr(0,sep_pos);
     if (sep_pos!=std::string::npos)
         second = s.substr(sep_pos+1);
     else
         // no time set, so we want to get midnight!
         second = ::std::string("00:00:00");
     return true;
   }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12449>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC