63 std::replace(s.begin(), s.end(),
'T',
' ');
65 boost::posix_time::ptime t;
70 t = boost::posix_time::time_from_string(s);
72 catch (
const std::exception& ex)
74 std::ostringstream text;
75 text <<
"cannot parse " << value <<
" = \'" << in <<
"\': \"" << ex.what() <<
"\" (ISO 8601 format (YYYY-MM-DD HH:MM:SS) is expected).";
76 throw std::runtime_error(text.str().c_str());
85 boost::local_time::local_date_time lt(t.date(), t.time_of_day(), tz_ptr, boost::local_time::local_date_time::EXCEPTION_ON_ERROR);
86 TLOG_DEBUG(1) <<
"Build zone\'s time \'" << in <<
"\' => \'" << lt.to_string() <<
"\' using \'" << tz_ptr->to_posix_string() <<
'\'' ;
89 catch(std::exception& e)
91 std::ostringstream text;
92 text <<
"cannot parse " << value <<
" = \'" << in <<
"\' in time zone \"" << tz_ptr->to_posix_string() <<
"\": \"" << e.what() <<
'\"' << std::endl;
93 throw std::runtime_error(text.str().c_str());