| 16463 | |
| 16464 | namespace { |
| 16465 | std::string getCurrentTimestamp() { |
| 16466 | // Beware, this is not reentrant because of backward compatibility issues |
| 16467 | // Also, UTC only, again because of backward compatibility (%z is C++11) |
| 16468 | time_t rawtime; |
| 16469 | std::time(&rawtime); |
| 16470 | auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); |
| 16471 | |
| 16472 | #ifdef _MSC_VER |
| 16473 | std::tm timeInfo = {}; |
| 16474 | gmtime_s(&timeInfo, &rawtime); |
| 16475 | #else |
| 16476 | std::tm* timeInfo; |
| 16477 | timeInfo = std::gmtime(&rawtime); |
| 16478 | #endif |
| 16479 | |
| 16480 | char timeStamp[timeStampSize]; |
| 16481 | const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; |
| 16482 | |
| 16483 | #ifdef _MSC_VER |
| 16484 | std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); |
| 16485 | #else |
| 16486 | std::strftime(timeStamp, timeStampSize, fmt, timeInfo); |
| 16487 | #endif |
| 16488 | return std::string(timeStamp); |
| 16489 | } |
| 16490 | |
| 16491 | std::string fileNameTag(const std::vector<std::string> &tags) { |
| 16492 | auto it = std::find_if(begin(tags), |