mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 02:35:33 +08:00
Ref T297, calculate ts differences ITimestampObjectList::getTimestampDifferenceMinMaxMean
This commit is contained in:
@@ -21,6 +21,23 @@ class QDateTime;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
//! Milliseconds minimum/maximum/mean
|
||||
struct MillisecondsMinMaxMean
|
||||
{
|
||||
qint64 min; //!< Minimum
|
||||
qint64 max; //!< Maximum
|
||||
double mean; //!< Mean (average)
|
||||
|
||||
//! Valid?
|
||||
bool isValid() const { return min >= 0 && max >= 0; }
|
||||
|
||||
//! Reset the values
|
||||
void reset() { min = -1; max = -1; mean = -1;}
|
||||
|
||||
//! As string
|
||||
QString asString() const { static const QString s("Min: %1 Max: %2 Mean: %3"); return s.arg(min).arg(max).arg(mean, 0, 'f', 2); }
|
||||
};
|
||||
|
||||
//! List of objects with timestamp.
|
||||
//! Such objects should implement \sa ITimestampBased
|
||||
template<class OBJ, class CONTAINER> class ITimestampObjectList
|
||||
@@ -30,7 +47,8 @@ namespace BlackMisc
|
||||
enum HintTimestampSort
|
||||
{
|
||||
NoTimestampSortHint,
|
||||
TimestampLatestFirst
|
||||
TimestampLatestFirst,
|
||||
TimestampLatestLast
|
||||
};
|
||||
|
||||
//! List of objects before dateTime (older)
|
||||
@@ -125,6 +143,10 @@ namespace BlackMisc
|
||||
//! Adds a time to all values
|
||||
void addMsecs(qint64 msToAdd);
|
||||
|
||||
//! Difference of timestamp values
|
||||
//! \cond timestamp list has to be sorted to get meaninful values
|
||||
MillisecondsMinMaxMean getTimestampDifferenceMinMaxMean() const;
|
||||
|
||||
//! Set the hint
|
||||
void setSortHint(HintTimestampSort hint) { m_tsSortHint = hint; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user