MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / ToIsoTime

Method ToIsoTime

lib/mdflib/mdflib/src/timestamp.cpp:63–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63std::string UtcTimestamp::ToIsoTime(bool include_ms) const {
64 const auto ms_sec = (utc_timestamp_ / 1'000'000) % 1'000;
65 const auto system_time = static_cast<std::time_t>(utc_timestamp_ / 1'000'000'000);
66 std::ostringstream text;
67 if (struct tm *bt = std::gmtime(&system_time);
68 bt != nullptr ) {
69 text << std::put_time(bt, "%H:%M:%S");
70 }
71 if (ms_sec > 0 && include_ms) {
72 text << '.' << std::setfill('0') << std::setw(3) << ms_sec;
73 }
74 text << "Z";
75 return text.str();
76}
77
78std::string UtcTimestamp::ToIsoDateTime(bool include_ms) const {
79 const auto ms_sec = (utc_timestamp_ / 1'000'000) % 1'000;

Callers 2

TEST_FFunction · 0.80
ValueMethod · 0.80

Calls

no outgoing calls

Tested by 1

TEST_FFunction · 0.64