MCPcopy Create free account
hub / github.com/Compaile/ctrack / getCurrentTimestamp

Method getCurrentTimestamp

test/doctest.h:5743–5762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5741 struct JUnitTestCaseData
5742 {
5743 static std::string getCurrentTimestamp() {
5744 // Beware, this is not reentrant because of backward compatibility issues
5745 // Also, UTC only, again because of backward compatibility (%z is C++11)
5746 time_t rawtime;
5747 std::time(&rawtime);
5748 auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
5749
5750 std::tm timeInfo;
5751#ifdef DOCTEST_PLATFORM_WINDOWS
5752 gmtime_s(&timeInfo, &rawtime);
5753#else // DOCTEST_PLATFORM_WINDOWS
5754 gmtime_r(&rawtime, &timeInfo);
5755#endif // DOCTEST_PLATFORM_WINDOWS
5756
5757 char timeStamp[timeStampSize];
5758 const char* const fmt = "%Y-%m-%dT%H:%M:%SZ";
5759
5760 std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
5761 return std::string(timeStamp);
5762 }
5763
5764 struct JUnitTestMessage
5765 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected