MCPcopy Create free account
hub / github.com/catchorg/Catch2 / getCurrentTimestamp

Function getCurrentTimestamp

extras/catch_amalgamated.cpp:11001–11023  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10999
11000 namespace {
11001 std::string getCurrentTimestamp() {
11002 time_t rawtime;
11003 std::time(&rawtime);
11004
11005 std::tm timeInfo = {};
11006#if defined (_MSC_VER) || defined (__MINGW32__)
11007 gmtime_s(&timeInfo, &rawtime);
11008#elif defined (CATCH_PLATFORM_PLAYSTATION)
11009 gmtime_s(&rawtime, &timeInfo);
11010#elif defined (__IAR_SYSTEMS_ICC__)
11011 timeInfo = *std::gmtime(&rawtime);
11012#else
11013 gmtime_r(&rawtime, &timeInfo);
11014#endif
11015
11016 auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
11017 char timeStamp[timeStampSize];
11018 const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
11019
11020 std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
11021
11022 return std::string(timeStamp, timeStampSize - 1);
11023 }
11024
11025 std::string fileNameTag(std::vector<Tag> const& tags) {
11026 auto it = std::find_if(begin(tags),

Callers 1

writeRunMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected