MCPcopy Create free account
hub / github.com/SeisSol/SeisSol / getCurrentTimestamp

Method getCurrentTimestamp

external/doctest.h:5276–5295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5274 struct JUnitTestCaseData
5275 {
5276 static std::string getCurrentTimestamp() {
5277 // Beware, this is not reentrant because of backward compatibility issues
5278 // Also, UTC only, again because of backward compatibility (%z is C++11)
5279 time_t rawtime;
5280 std::time(&rawtime);
5281 auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
5282
5283 std::tm timeInfo;
5284#ifdef DOCTEST_PLATFORM_WINDOWS
5285 gmtime_s(&timeInfo, &rawtime);
5286#else // DOCTEST_PLATFORM_WINDOWS
5287 gmtime_r(&rawtime, &timeInfo);
5288#endif // DOCTEST_PLATFORM_WINDOWS
5289
5290 char timeStamp[timeStampSize];
5291 const char* const fmt = "%Y-%m-%dT%H:%M:%SZ";
5292
5293 std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
5294 return std::string(timeStamp);
5295 }
5296
5297 struct JUnitTestMessage
5298 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected