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

Method ToIsoDateTime

lib/mdflib/mdflib/src/timestamp.cpp:78–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78std::string UtcTimestamp::ToIsoDateTime(bool include_ms) const {
79 const auto ms_sec = (utc_timestamp_ / 1'000'000) % 1'000;
80 const auto system_time = static_cast<std::time_t>(utc_timestamp_ / 1'000'000'000);
81 std::ostringstream text;
82 if (struct tm *bt = std::gmtime(&system_time);
83 bt != nullptr ) {
84 text << std::put_time(bt, "%Y-%m-%dT%H:%M:%S");
85 }
86 if (ms_sec > 0 && include_ms) {
87 text << '.' << std::setfill('0') << std::setw(3) << ms_sec;
88 }
89 text << "Z";
90 return text.str();
91}
92
93void UtcTimestamp::FromIsoDateTime(const std::string &date_time) {
94 enum DateState {

Callers 3

TEST_FFunction · 0.80
DateNsMethod · 0.80
ValueMethod · 0.80

Calls

no outgoing calls

Tested by 1

TEST_FFunction · 0.64