Skip to content

Commit

Permalink
[apps] CSV stats timepoint follows ISO 8601 format
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko committed Nov 9, 2020
1 parent 2e39603 commit 06a3c1e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/apputil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ class SrtStatsCsv : public SrtStatsWriter
srt_getsockopt(sid, 0, SRTO_RCVLATENCY, &rcv_latency, &int_len);

#ifdef HAS_PUT_TIME
// Follows ISO 8601
auto print_timestamp = [&output]() {
using namespace std;
using namespace std::chrono;
Expand All @@ -454,11 +455,11 @@ class SrtStatsCsv : public SrtStatsWriter

// SysLocalTime returns zeroed tm_now on failure, which is ok for put_time.
const tm tm_now = SysLocalTime(time_now);
output << std::put_time(&tm_now, "%d.%m.%Y %T.") << std::setfill('0') << std::setw(6);
output << std::put_time(&tm_now, "%FT%T.") << std::setfill('0') << std::setw(6);
const auto since_epoch = systime_now.time_since_epoch();
const seconds s = duration_cast<seconds>(since_epoch);
output << duration_cast<microseconds>(since_epoch - s).count();
output << std::put_time(&tm_now, " %z");
output << std::put_time(&tm_now, "%z");
output << ",";
};

Expand Down

0 comments on commit 06a3c1e

Please sign in to comment.