| 16794 | |
| 16795 | namespace { |
| 16796 | std::string getCurrentTimestamp() { |
| 16797 | // Beware, this is not reentrant because of backward compatibility issues |
| 16798 | // Also, UTC only, again because of backward compatibility (%z is C++11) |
| 16799 | time_t rawtime; |
| 16800 | std::time(&rawtime); |
| 16801 | auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); |
| 16802 | |
| 16803 | #ifdef _MSC_VER |
| 16804 | std::tm timeInfo = {}; |
| 16805 | gmtime_s(&timeInfo, &rawtime); |
| 16806 | #else |
| 16807 | std::tm* timeInfo; |
| 16808 | timeInfo = std::gmtime(&rawtime); |
| 16809 | #endif |
| 16810 | |
| 16811 | char timeStamp[timeStampSize]; |
| 16812 | const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; |
| 16813 | |
| 16814 | #ifdef _MSC_VER |
| 16815 | std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); |
| 16816 | #else |
| 16817 | std::strftime(timeStamp, timeStampSize, fmt, timeInfo); |
| 16818 | #endif |
| 16819 | return std::string(timeStamp); |
| 16820 | } |
| 16821 | |
| 16822 | std::string fileNameTag(const std::vector<std::string> &tags) { |
| 16823 | auto it = std::find_if(begin(tags), |