some more bugfixes
This commit is contained in:
parent
5b0f80509f
commit
640cc1ddec
@ -9,7 +9,7 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
Stopwatch::Stopwatch(bool displayOnDestruction,
|
Stopwatch::Stopwatch(bool displayOnDestruction,
|
||||||
StopwatchDisplayMode displayMode):
|
StopwatchDisplayMode displayMode): displayMode(displayMode),
|
||||||
displayOnDestruction(displayOnDestruction) {
|
displayOnDestruction(displayOnDestruction) {
|
||||||
// Measures start time on initialization.
|
// Measures start time on initialization.
|
||||||
Clock::getUptime(&startTime);
|
Clock::getUptime(&startTime);
|
||||||
@ -32,12 +32,12 @@ seconds_t Stopwatch::stopSeconds() {
|
|||||||
void Stopwatch::display() {
|
void Stopwatch::display() {
|
||||||
if(displayMode == StopwatchDisplayMode::MILLIS) {
|
if(displayMode == StopwatchDisplayMode::MILLIS) {
|
||||||
info << "Stopwatch: Operation took " << elapsedTime.tv_sec * 1000 +
|
info << "Stopwatch: Operation took " << elapsedTime.tv_sec * 1000 +
|
||||||
elapsedTime.tv_usec * 1000 << " milliseconds";
|
elapsedTime.tv_usec * 1000 << " milliseconds" << std::endl;
|
||||||
}
|
}
|
||||||
else if(displayMode == StopwatchDisplayMode::SECONDS) {
|
else if(displayMode == StopwatchDisplayMode::SECONDS) {
|
||||||
info <<"Stopwatch: Operation took " << std::setprecision(4)
|
info <<"Stopwatch: Operation took " << std::setprecision(3)
|
||||||
<< std::fixed << timevalOperations::toDouble(elapsedTime)
|
<< std::fixed << timevalOperations::toDouble(elapsedTime)
|
||||||
<< " seconds";
|
<< " seconds" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,9 +60,8 @@ private:
|
|||||||
timeval startTime {0, 0};
|
timeval startTime {0, 0};
|
||||||
timeval elapsedTime {0, 0};
|
timeval elapsedTime {0, 0};
|
||||||
|
|
||||||
bool displayOnDestruction = true;
|
|
||||||
StopwatchDisplayMode displayMode = StopwatchDisplayMode::MILLIS;
|
StopwatchDisplayMode displayMode = StopwatchDisplayMode::MILLIS;
|
||||||
|
bool displayOnDestruction = true;
|
||||||
void stopInternal();
|
void stopInternal();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user