2 * Copyright 2010, Stephan Aßmus <superstippi@gmx.de>
3 * Distributed under the terms of the MIT License.
7 #include "DurationToString.h"
13 duration_to_string(int32 seconds
, char* string
, size_t stringSize
)
15 bool negative
= seconds
< 0;
19 int32 hours
= seconds
/ 3600;
20 seconds
-= hours
* 3600;
21 int32 minutes
= seconds
/ 60;
22 seconds
= seconds
% 60;
25 snprintf(string
, stringSize
, "%s%" B_PRId32
":%02" B_PRId32
":%02"
26 B_PRId32
, negative
? "-" : "", hours
, minutes
, seconds
);
28 snprintf(string
, stringSize
, "%s%" B_PRId32
":%02" B_PRId32
,
29 negative
? "-" : "", minutes
, seconds
);