| 13710 | |
| 13711 | namespace { |
| 13712 | std::string getCurrentTimestamp() { |
| 13713 | // Beware, this is not reentrant because of backward compatibility issues |
| 13714 | // Also, UTC only, again because of backward compatibility (%z is C++11) |
| 13715 | time_t rawtime; |
| 13716 | std::time(&rawtime); |
| 13717 | auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); |
| 13718 | |
| 13719 | #ifdef _MSC_VER |
| 13720 | std::tm timeInfo = {}; |
| 13721 | gmtime_s(&timeInfo, &rawtime); |
| 13722 | #else |
| 13723 | std::tm* timeInfo; |
| 13724 | timeInfo = std::gmtime(&rawtime); |
| 13725 | #endif |
| 13726 | |
| 13727 | char timeStamp[timeStampSize]; |
| 13728 | const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; |
| 13729 | |
| 13730 | #ifdef _MSC_VER |
| 13731 | std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); |
| 13732 | #else |
| 13733 | std::strftime(timeStamp, timeStampSize, fmt, timeInfo); |
| 13734 | #endif |
| 13735 | return std::string(timeStamp); |
| 13736 | } |
| 13737 | |
| 13738 | std::string fileNameTag(const std::vector<std::string> &tags) { |
| 13739 | auto it = std::find_if(begin(tags), |