MCPcopy Create free account
hub / github.com/IENT/YUView / timestampToString

Function timestampToString

YUViewLib/src/ffmpeg/FFMpegLibrariesTypes.cpp:38–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36{
37
38QString timestampToString(int64_t timestamp, AVRational timebase)
39{
40 auto d_seconds = (double)timestamp * timebase.num / timebase.den;
41 auto hours = (int)(d_seconds / 60 / 60);
42 d_seconds -= hours * 60 * 60;
43 auto minutes = (int)(d_seconds / 60);
44 d_seconds -= minutes * 60;
45 auto seconds = (int)d_seconds;
46 d_seconds -= seconds;
47 auto milliseconds = (int)(d_seconds * 1000);
48
49 return QString("%1:%2:%3.%4")
50 .arg(hours, 2, 10, QChar('0'))
51 .arg(minutes, 2, 10, QChar('0'))
52 .arg(seconds, 2, 10, QChar('0'))
53 .arg(milliseconds, 3, 10, QChar('0'));
54}
55
56} // namespace FFmpeg

Callers 2

getInfoTextMethod · 0.85
getInfoTextMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected