Allow conversion of TimeSpan to string with total seconds
This commit is contained in:
parent
424a0bfb6f
commit
3051675bbe
|
@ -157,6 +157,12 @@ void TimeSpan::toString(string &result, TimeSpanOutputFormat format, bool fullSe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case TimeSpanOutputFormat::TotalSeconds:
|
||||||
|
if (fullSeconds) {
|
||||||
|
s << setprecision(0);
|
||||||
|
}
|
||||||
|
s << positive.totalSeconds();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
result = s.str();
|
result = s.str();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,8 @@ class DateTime;
|
||||||
*/
|
*/
|
||||||
enum class TimeSpanOutputFormat {
|
enum class TimeSpanOutputFormat {
|
||||||
Normal, /**< the normal form of specifing a time interval: hh:mm:ss */
|
Normal, /**< the normal form of specifing a time interval: hh:mm:ss */
|
||||||
WithMeasures /**< measures are used, eg.: 34 d 5 h 10 min 7 s 31 ms */
|
WithMeasures, /**< measures are used, eg.: 34 d 5 h 10 min 7 s 31 ms */
|
||||||
|
TotalSeconds, /**< total seconds (as returned by totalSeconds()), eg. 2304.342 */
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPP_UTILITIES_EXPORT TimeSpan {
|
class CPP_UTILITIES_EXPORT TimeSpan {
|
||||||
|
|
Loading…
Reference in New Issue