| 51 | uint64_t UtcTimestamp::GetUtcTimeNs() const { return utc_timestamp_; } |
| 52 | |
| 53 | std::string UtcTimestamp::ToIsoDate() const { |
| 54 | const auto system_time = static_cast<std::time_t>(utc_timestamp_ / 1'000'000'000); |
| 55 | std::ostringstream text; |
| 56 | if (const struct tm *bt = std::gmtime(&system_time); |
| 57 | bt != nullptr ) { |
| 58 | text << std::put_time(bt, "%Y-%m-%dZ"); |
| 59 | } |
| 60 | return text.str(); |
| 61 | } |
| 62 | |
| 63 | std::string UtcTimestamp::ToIsoTime(bool include_ms) const { |
| 64 | const auto ms_sec = (utc_timestamp_ / 1'000'000) % 1'000; |