MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / getDateTimeStr

Function getDateTimeStr

libminifi/include/utils/TimeUtil.h:182–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182inline bool getDateTimeStr(int64_t unix_timestamp, std::string& date_time_str) {
183 if (unix_timestamp > (std::numeric_limits<time_t>::max)() || unix_timestamp < (std::numeric_limits<time_t>::lowest)()) {
184 return false;
185 }
186 time_t time = static_cast<time_t>(unix_timestamp);
187 struct tm* gmt = gmtime(&time); // NOLINT
188 if (gmt == nullptr) {
189 return false;
190 }
191 std::array<char, 64U> buf;
192 if (strftime(buf.data(), buf.size(), "%Y-%m-%dT%H:%M:%SZ", gmt) == 0U) {
193 return false;
194 }
195
196 date_time_str = buf.data();
197 return true;
198}
199
200} /* namespace timeutils */
201} /* namespace utils */

Callers 2

ListSFTPTests.cppFile · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected