Merge pull request 'use timeval instead of uptime for stopwatch' (#125) from stopwatch-fix into develop

Reviewed-on: #125
Reviewed-by: Robin Müller <muellerr@irs.uni-stuttgart.de>
This commit is contained in:
Robin Müller 2023-02-24 16:51:28 +01:00
commit 174a6aa862

View File

@ -9,7 +9,7 @@
Stopwatch::Stopwatch(bool displayOnDestruction, StopwatchDisplayMode displayMode) Stopwatch::Stopwatch(bool displayOnDestruction, StopwatchDisplayMode displayMode)
: displayOnDestruction(displayOnDestruction), displayMode(displayMode) { : displayOnDestruction(displayOnDestruction), displayMode(displayMode) {
// Measures start time on initialization. // Measures start time on initialization.
Clock::getUptime(&startTime); Clock::getClock_timeval(&startTime);
} }
void Stopwatch::start() { Clock::getUptime(&startTime); } void Stopwatch::start() { Clock::getUptime(&startTime); }
@ -63,6 +63,6 @@ StopwatchDisplayMode Stopwatch::getDisplayMode() const { return displayMode; }
void Stopwatch::stopInternal() { void Stopwatch::stopInternal() {
timeval endTime; timeval endTime;
Clock::getUptime(&endTime); Clock::getClock_timeval(&endTime);
elapsedTime = endTime - startTime; elapsedTime = endTime - startTime;
} }