Base: Remove StopWatch
StopWatch is now used on single place only, remove it in favour of TimeElapsed
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
#include <locale>
|
||||
#include <iostream>
|
||||
#include <QDateTime>
|
||||
#include <QElapsedTimer>
|
||||
#endif
|
||||
|
||||
#include "PyExport.h"
|
||||
@@ -373,62 +372,3 @@ std::string Base::Tools::currentDateTimeString()
|
||||
.toString(Qt::ISODate)
|
||||
.toStdString();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
using namespace Base;
|
||||
|
||||
struct StopWatch::Private
|
||||
{
|
||||
QElapsedTimer t;
|
||||
};
|
||||
|
||||
StopWatch::StopWatch()
|
||||
: d(new Private)
|
||||
{}
|
||||
|
||||
StopWatch::~StopWatch()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void StopWatch::start()
|
||||
{
|
||||
d->t.start();
|
||||
}
|
||||
|
||||
int StopWatch::restart()
|
||||
{
|
||||
return d->t.restart();
|
||||
}
|
||||
|
||||
int StopWatch::elapsed()
|
||||
{
|
||||
return d->t.elapsed();
|
||||
}
|
||||
|
||||
std::string StopWatch::toString(int ms) const
|
||||
{
|
||||
int total = ms;
|
||||
int msec = total % 1000;
|
||||
total = total / 1000;
|
||||
int secs = total % 60;
|
||||
total = total / 60;
|
||||
int mins = total % 60;
|
||||
int hour = total / 60;
|
||||
std::stringstream str;
|
||||
str << "Needed time: ";
|
||||
if (hour > 0) {
|
||||
str << hour << "h " << mins << "m " << secs << "s";
|
||||
}
|
||||
else if (mins > 0) {
|
||||
str << mins << "m " << secs << "s";
|
||||
}
|
||||
else if (secs > 0) {
|
||||
str << secs << "s";
|
||||
}
|
||||
else {
|
||||
str << msec << "ms";
|
||||
}
|
||||
return str.str();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user