mirror of
https://github.com/catchorg/Catch2.git
synced 2025-07-01 07:05:32 +02:00
JUnit reporter: Added ISO8601 timestamp to the timestamp attribute.
This commit is contained in:
parent
7eb5acc183
commit
c268cea41d
@ -15,6 +15,7 @@
|
||||
#include "../internal/catch_xmlwriter.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctime>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
@ -86,7 +87,17 @@ namespace Catch {
|
||||
xml.writeAttribute( "time", "" );
|
||||
else
|
||||
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
|
||||
for( TestGroupNode::ChildNodes::const_iterator
|
||||
|
Loading…
x
Reference in New Issue
Block a user