MCPcopy Create free account
hub / github.com/RenderKit/embree / getCurrentTimestamp

Function getCurrentTimestamp

tutorials/external/catch.hpp:14008–14032  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14006
14007 namespace {
14008 std::string getCurrentTimestamp() {
14009 // Beware, this is not reentrant because of backward compatibility issues
14010 // Also, UTC only, again because of backward compatibility (%z is C++11)
14011 time_t rawtime;
14012 std::time(&rawtime);
14013 auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
14014
14015#ifdef _MSC_VER
14016 std::tm timeInfo = {};
14017 gmtime_s(&timeInfo, &rawtime);
14018#else
14019 std::tm* timeInfo;
14020 timeInfo = std::gmtime(&rawtime);
14021#endif
14022
14023 char timeStamp[timeStampSize];
14024 const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
14025
14026#ifdef _MSC_VER
14027 std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
14028#else
14029 std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
14030#endif
14031 return std::string(timeStamp);
14032 }
14033
14034 std::string fileNameTag(const std::vector<std::string> &tags) {
14035 auto it = std::find_if(begin(tags),

Callers 1

writeGroupMethod · 0.85

Calls 1

timeFunction · 0.85

Tested by

no test coverage detected