Bug 795377 - Reads and saves Gnucash 2.6.19 XML file, then can't reread it, due to bad date in old file

This commit contains another round of cleanups in the
timespec to time64 conversion. There were a number of
false assumptions that time64 = 0 would be a bad date
in the xml parser. This commit corrects enough of them to
eliminate the bug. Further cleanup is probably advised but
can be done at a later stage.
This commit is contained in:
Geert Janssens
2018-04-28 12:16:52 +02:00
parent 9c4469d039
commit b761b5a0dc
5 changed files with 29 additions and 41 deletions

View File

@@ -1202,7 +1202,7 @@ time64
gnc_iso8601_to_time64_gmt(const char *cstr)
{
time64 time;
if (!cstr) return 0;
if (!cstr) return INT64_MAX;
try
{
GncDateTime gncdt(cstr);
@@ -1211,12 +1211,12 @@ gnc_iso8601_to_time64_gmt(const char *cstr)
catch(std::logic_error& err)
{
PWARN("Error processing %s: %s", cstr, err.what());
return 0;
return INT64_MAX;
}
catch(std::runtime_error& err)
{
PWARN("Error processing time64 %s: %s", cstr, err.what());
return 0;
return INT64_MAX;
}
}