Implement a faster date-time serialization function.

Has the side effect of recording all date-times in XML files in UTC
instead of local time with a timezone.
This commit is contained in:
John Ralls
2018-12-28 16:39:02 -08:00
parent 137c920d06
commit 9fa7b7f940
7 changed files with 33 additions and 19 deletions

View File

@@ -35,6 +35,7 @@ extern "C"
#include "sixtp-utils.h"
#include <kvp-frame.hpp>
#include <gnc-datetime.hpp>
static QofLogModule log_module = GNC_MOD_IO;
@@ -136,13 +137,12 @@ time64_to_dom_tree (const char* tag, const time64 time)
{
xmlNodePtr ret;
g_return_val_if_fail (time != INT64_MAX, NULL);
auto date_str = gnc_print_time64 (time, "%Y-%m-%d %H:%M:%S %q");
if (!date_str)
auto date_str = GncDateTime(time).format_iso8601();
if (date_str.empty())
return NULL;
ret = xmlNewNode (NULL, BAD_CAST tag);
xmlNewTextChild (ret, NULL, BAD_CAST "ts:date",
checked_char_cast (date_str));
g_free (date_str);
checked_char_cast (const_cast<char*>(date_str.c_str())));
return ret;
}