JUnit reporter: Added ISO8601 timestamp to the timestamp attribute.

This commit is contained in:
sevas 2014-01-13 22:25:28 +01:00
parent 7eb5acc183
commit c268cea41d

View File

@ -15,6 +15,7 @@
#include "../internal/catch_xmlwriter.hpp" #include "../internal/catch_xmlwriter.hpp"
#include <assert.h> #include <assert.h>
#include <ctime>
namespace Catch { namespace Catch {
@ -86,7 +87,17 @@ namespace Catch {
xml.writeAttribute( "time", "" ); xml.writeAttribute( "time", "" );
else else
xml.writeAttribute( "time", suiteTime ); xml.writeAttribute( "time", suiteTime );
xml.writeAttribute( "timestamp", "tbd" ); // !TBD
time_t rawtime;
struct tm * timeinfo;
const size_t timestampLength = 33;
char iso8601Timestamp[timestampLength];
time(&rawtime);
timeinfo = localtime(&rawtime);
strftime (iso8601Timestamp,timestampLength, "%Y-%m-%dT%T%z", timeinfo);
xml.writeAttribute( "timestamp", iso8601Timestamp );
// Write test cases // Write test cases
for( TestGroupNode::ChildNodes::const_iterator for( TestGroupNode::ChildNodes::const_iterator