stopwatch ms now working
This commit is contained in:
parent
8a8761ea88
commit
841b28b65d
@ -12,7 +12,7 @@ Stopwatch::Stopwatch(bool displayOnDestruction,
|
|||||||
StopwatchDisplayMode displayMode): displayMode(displayMode),
|
StopwatchDisplayMode displayMode): displayMode(displayMode),
|
||||||
displayOnDestruction(displayOnDestruction) {
|
displayOnDestruction(displayOnDestruction) {
|
||||||
// Measures start time on initialization.
|
// Measures start time on initialization.
|
||||||
Clock::getUptime(&startTime);
|
startTime = Clock::getUptime();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stopwatch::start() {
|
void Stopwatch::start() {
|
||||||
@ -31,8 +31,8 @@ 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" << std::endl;
|
elapsedTime.tv_usec / 1000) << " milliseconds" << std::endl;
|
||||||
}
|
}
|
||||||
else if(displayMode == StopwatchDisplayMode::SECONDS) {
|
else if(displayMode == StopwatchDisplayMode::SECONDS) {
|
||||||
info <<"Stopwatch: Operation took " << std::setprecision(3)
|
info <<"Stopwatch: Operation took " << std::setprecision(3)
|
||||||
|
Loading…
Reference in New Issue
Block a user