MCPcopy Create free account
hub / github.com/apache/qpid-proton / getCurrentTimestamp

Function getCurrentTimestamp

tests/include/catch.hpp:16812–16836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

writeGroupMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected