| 19471 | |
| 19472 | namespace { |
| 19473 | std::string getCurrentTimestamp() |
| 19474 | { |
| 19475 | // Beware, this is not reentrant because of backward compatibility issues |
| 19476 | // Also, UTC only, again because of backward compatibility (%z is C++11) |
| 19477 | time_t rawtime; |
| 19478 | std::time(&rawtime); |
| 19479 | auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); |
| 19480 | |
| 19481 | #ifdef _MSC_VER |
| 19482 | std::tm timeInfo = {}; |
| 19483 | gmtime_s(&timeInfo, &rawtime); |
| 19484 | #else |
| 19485 | std::tm *timeInfo; |
| 19486 | timeInfo = std::gmtime(&rawtime); |
| 19487 | #endif |
| 19488 | |
| 19489 | char timeStamp[timeStampSize]; |
| 19490 | const char *const fmt = "%Y-%m-%dT%H:%M:%SZ"; |
| 19491 | |
| 19492 | #ifdef _MSC_VER |
| 19493 | std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); |
| 19494 | #else |
| 19495 | std::strftime(timeStamp, timeStampSize, fmt, timeInfo); |
| 19496 | #endif |
| 19497 | return std::string(timeStamp, timeStampSize - 1); |
| 19498 | } |
| 19499 | |
| 19500 | std::string fileNameTag(const std::vector<std::string> &tags) |
| 19501 | { |