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

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12449: date_time from string throws exception if time not set
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-12-26 22:20:07


#12449: date_time from string throws exception if time not set
---------------------------------+------------------------
  Reporter: peter.kirchweger@… | Owner: az_sw_dude
      Type: Feature Requests | Status: closed
 Milestone: To Be Determined | Component: date_time
   Version: Boost 1.61.0 | Severity: Problem
Resolution: wontfix | Keywords:
---------------------------------+------------------------
Changes (by James E. King, III):

 * status: new => closed
 * resolution: => wontfix

Comment:

 The method you are looking for is date_from_iso_string, which only takes
 YYYYMMDD.
 parse_iso_time is documented as requiring the full string:

 {{{
   //! Parse time string of form YYYYMMDDThhmmss where T is delimeter
 between date and time
   template<class time_type>
   inline
   time_type
   parse_iso_time(const std::string& s, char sep)
 }}}

 The code path you describe currently throws std::out_of_range because the
 code is trying to look at the first character after the "T" and failing,
 using std::string::at. An exception here is appropriate as the input is
 invalid; std::invalid_argument or a runtime_error might be more reasonable
 than a flavor of logic_error, but I don't think it's worth the effort in
 this case.

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/12449#comment:1>
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-12-26 22:24:05 UTC