diff --git a/chrono/timespan.cpp b/chrono/timespan.cpp index ddb40ef..697a37d 100644 --- a/chrono/timespan.cpp +++ b/chrono/timespan.cpp @@ -157,6 +157,12 @@ void TimeSpan::toString(string &result, TimeSpanOutputFormat format, bool fullSe } } break; + case TimeSpanOutputFormat::TotalSeconds: + if (fullSeconds) { + s << setprecision(0); + } + s << positive.totalSeconds(); + break; } result = s.str(); } diff --git a/chrono/timespan.h b/chrono/timespan.h index 791d3fa..aa36928 100644 --- a/chrono/timespan.h +++ b/chrono/timespan.h @@ -21,7 +21,8 @@ class DateTime; */ enum class TimeSpanOutputFormat { 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 {