MCPcopy Create free account
hub / github.com/Haivision/srt / FormatTime

Function FormatTime

srtcore/sync.cpp:39–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37{
38
39std::string FormatTime(const steady_clock::time_point& timestamp)
40{
41 if (is_zero(timestamp))
42 {
43 // Use special string for 0
44 return "00:00:00.000000 [STDY]";
45 }
46
47 const int decimals = clockSubsecondPrecision();
48 const uint64_t total_sec = count_seconds(timestamp.time_since_epoch());
49 const uint64_t days = total_sec / (60 * 60 * 24);
50 const uint64_t hours = total_sec / (60 * 60) - days * 24;
51 const uint64_t minutes = total_sec / 60 - (days * 24 * 60) - hours * 60;
52 const uint64_t seconds = total_sec - (days * 24 * 60 * 60) - hours * 60 * 60 - minutes * 60;
53 ostringstream out;
54 if (days)
55 out << days << "D ";
56 out << setfill('0') << setw(2) << hours << ":"
57 << setfill('0') << setw(2) << minutes << ":"
58 << setfill('0') << setw(2) << seconds << "."
59 << setfill('0') << setw(decimals) << (timestamp - seconds_from(total_sec)).time_since_epoch().count() << " [STDY]";
60 return out.str();
61}
62
63std::string FormatTimeSys(const steady_clock::time_point& timestamp)
64{

Callers 15

readBufferToMethod · 0.85
traceMethod · 0.85
addDriftSampleMethod · 0.85
applyGroupDriftMethod · 0.85
updateBaseTimeMethod · 0.85
pickupMethod · 0.85
traceMethod · 0.85
processSrtMsg_HSRSPMethod · 0.85
synchronizeWithGroupMethod · 0.85
startConnectMethod · 0.85
tsbpdMethod · 0.85
setupCCMethod · 0.85

Calls 7

is_zeroFunction · 0.85
clockSubsecondPrecisionFunction · 0.85
count_secondsFunction · 0.85
seconds_fromFunction · 0.85
time_since_epochMethod · 0.80
countMethod · 0.45
strMethod · 0.45

Tested by 1

TESTFunction · 0.68