MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / format_time

Function format_time

src/framework/text/subtitle.cpp:86–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86std::string format_time(int64_t sample, int sample_rate) {
87 const int64_t ms = (sample * 1000 + sample_rate / 2) / sample_rate;
88 const int64_t hours = ms / 3600000;
89 const int64_t minutes = (ms / 60000) % 60;
90 const int64_t seconds = (ms / 1000) % 60;
91 const int64_t millis = ms % 1000;
92
93 std::ostringstream out;
94 out << std::setfill('0')
95 << std::setw(2) << hours << ':'
96 << std::setw(2) << minutes << ':'
97 << std::setw(2) << seconds << ','
98 << std::setw(3) << millis;
99 return out.str();
100}
101
102} // namespace
103

Callers 1

format_srtFunction · 0.85

Calls 1

strMethod · 0.80

Tested by

no test coverage detected