Fix the string constructor to apply the timezone correctly.

This commit is contained in:
John Ralls 2015-04-28 17:53:35 -07:00
parent ac515d6ce2
commit bcedeff3ba

View File

@ -156,9 +156,16 @@ GncDateTimeImpl::GncDateTimeImpl(const std::string str) :
{ {
tzptr = utc_zone; tzptr = utc_zone;
} }
try
{
auto pdt = boost::posix_time::time_from_string(str.substr(0, tzpos)); auto pdt = boost::posix_time::time_from_string(str.substr(0, tzpos));
m_time = LDT(pdt, tzptr); m_time = LDT(pdt.date(), pdt.time_of_day(), tzptr,
LDTBase::NOT_DATE_TIME_ON_ERROR);
}
catch(boost::gregorian::bad_year)
{
throw(std::invalid_argument("The date string was outside of the supported year range."));
}
} }
GncDateTimeImpl::operator time64() const GncDateTimeImpl::operator time64() const