| 133 | } |
| 134 | |
| 135 | std::string GenerateTimestampString() |
| 136 | { |
| 137 | auto now = std::chrono::system_clock::now(); |
| 138 | |
| 139 | // Split into seconds + fractional part |
| 140 | auto seconds = std::chrono::time_point_cast<std::chrono::seconds>(now); |
| 141 | auto fraction = now - seconds; |
| 142 | auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(fraction).count(); |
| 143 | |
| 144 | std::time_t t = std::chrono::system_clock::to_time_t(seconds); |
| 145 | |
| 146 | std::tm tm{}; |
| 147 | #if defined(_WIN32) |
| 148 | gmtime_s(&tm, &t); // Windows thread-safe |
| 149 | #else |
| 150 | gmtime_r(&t, &tm); // POSIX thread-safe |
| 151 | #endif |
| 152 | |
| 153 | std::ostringstream oss; |
| 154 | oss << std::put_time(&tm, "%Y-%m-%dT%H:%M:%S"); |
| 155 | |
| 156 | // Append fractional seconds |
| 157 | oss << "." << std::setw(3) << std::setfill('0') << millis; |
| 158 | |
| 159 | // UTC marker |
| 160 | oss << "Z"; |
| 161 | |
| 162 | return oss.str(); |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * @brief Mark a node as modified via REST API. |
no test coverage detected