From 6cdb79e2a611d99fa6e13dd224a92dc8badaf2ac Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 9 Nov 2009 03:42:06 -0500 Subject: XML reporting now works via the "xml" command --- src/times.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/times.h') diff --git a/src/times.h b/src/times.h index c2c2530e..3cd359d2 100644 --- a/src/times.h +++ b/src/times.h @@ -116,16 +116,26 @@ std::string format_date(const date_t& when, void set_date_format(const char * format); void set_input_date_format(const char * format); -inline void to_xml(std::ostream& out, const datetime_t& when) +inline void to_xml(std::ostream& out, const datetime_t& when, + bool wrap = true) { - push_xml x(out, "datetime"); - out << format_datetime(when, FMT_WRITTEN); + if (wrap) { + push_xml x(out, "datetime"); + out << format_datetime(when, FMT_WRITTEN); + } else { + out << format_datetime(when, FMT_WRITTEN); + } } -inline void to_xml(std::ostream& out, const date_t& when) +inline void to_xml(std::ostream& out, const date_t& when, + bool wrap = true) { - push_xml x(out, "date"); - out << format_date(when, FMT_WRITTEN); + if (wrap) { + push_xml x(out, "date"); + out << format_date(when, FMT_WRITTEN); + } else { + out << format_date(when, FMT_WRITTEN); + } } class date_interval_t : public equality_comparable -- cgit v1.2.3