MCPcopy Create free account
hub / github.com/bbc/audiowaveform / secondsToString

Function secondsToString

src/TimeUtil.cpp:34–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32//------------------------------------------------------------------------------
33
34int secondsToString(char* str, size_t size, int seconds)
35{
36 const int hours = seconds / 3600;
37
38 seconds -= hours * 3600;
39
40 const int minutes = seconds / 60;
41
42 seconds -= minutes * 60;
43
44 if (hours > 0) {
45 return snprintf(str, size, "%02d:%02d:%02d", hours, minutes, seconds);
46 }
47 else {
48 return snprintf(str, size, "%02d:%02d", minutes, seconds);
49 }
50}
51
52//------------------------------------------------------------------------------
53

Callers 3

TESTFunction · 0.85
updateMethod · 0.85
drawTimeAxisLabelsMethod · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68