| 16659 | |
| 16660 | namespace { |
| 16661 | std::string getCurrentTimestamp() { |
| 16662 | // Beware, this is not reentrant because of backward compatibility issues |
| 16663 | // Also, UTC only, again because of backward compatibility (%z is C++11) |
| 16664 | time_t rawtime; |
| 16665 | std::time(&rawtime); |
| 16666 | auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); |
| 16667 | |
| 16668 | #ifdef _MSC_VER |
| 16669 | std::tm timeInfo = {}; |
| 16670 | gmtime_s(&timeInfo, &rawtime); |
| 16671 | #else |
| 16672 | std::tm* timeInfo; |
| 16673 | timeInfo = std::gmtime(&rawtime); |
| 16674 | #endif |
| 16675 | |
| 16676 | char timeStamp[timeStampSize]; |
| 16677 | const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; |
| 16678 | |
| 16679 | #ifdef _MSC_VER |
| 16680 | std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); |
| 16681 | #else |
| 16682 | std::strftime(timeStamp, timeStampSize, fmt, timeInfo); |
| 16683 | #endif |
| 16684 | return std::string(timeStamp); |
| 16685 | } |
| 16686 | |
| 16687 | std::string fileNameTag(const std::vector<std::string> &tags) { |
| 16688 | auto it = std::find_if(begin(tags), |