MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / getCurrentTimestamp

Function getCurrentTimestamp

extern/Catch2/catch.hpp:16810–16834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16808
16809 namespace {
16810 std::string getCurrentTimestamp() {
16811 // Beware, this is not reentrant because of backward compatibility issues
16812 // Also, UTC only, again because of backward compatibility (%z is C++11)
16813 time_t rawtime;
16814 std::time(&rawtime);
16815 auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
16816
16817#ifdef _MSC_VER
16818 std::tm timeInfo = {};
16819 gmtime_s(&timeInfo, &rawtime);
16820#else
16821 std::tm* timeInfo;
16822 timeInfo = std::gmtime(&rawtime);
16823#endif
16824
16825 char timeStamp[timeStampSize];
16826 const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
16827
16828#ifdef _MSC_VER
16829 std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
16830#else
16831 std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
16832#endif
16833 return std::string(timeStamp, timeStampSize-1);
16834 }
16835
16836 std::string fileNameTag(const std::vector<std::string> &tags) {
16837 auto it = std::find_if(begin(tags),

Callers 1

writeGroupMethod · 0.85

Calls 1

stringFunction · 0.85

Tested by

no test coverage detected