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

Function getCurrentTimestamp

extlibs/catch/include/catch/catch.hpp:15965–15989  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15963
15964 namespace {
15965 std::string getCurrentTimestamp() {
15966 // Beware, this is not reentrant because of backward compatibility issues
15967 // Also, UTC only, again because of backward compatibility (%z is C++11)
15968 time_t rawtime;
15969 std::time(&rawtime);
15970 auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
15971
15972#ifdef _MSC_VER
15973 std::tm timeInfo = {};
15974 gmtime_s(&timeInfo, &rawtime);
15975#else
15976 std::tm* timeInfo;
15977 timeInfo = std::gmtime(&rawtime);
15978#endif
15979
15980 char timeStamp[timeStampSize];
15981 const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
15982
15983#ifdef _MSC_VER
15984 std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
15985#else
15986 std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
15987#endif
15988 return std::string(timeStamp);
15989 }
15990
15991 std::string fileNameTag(const std::vector<std::string> &tags) {
15992 auto it = std::find_if(begin(tags),

Callers 1

writeGroupMethod · 0.85

Calls 4

gmtime_sFunction · 0.85
gmtimeFunction · 0.85
strftimeFunction · 0.85
stringClass · 0.50

Tested by

no test coverage detected