Fix incorrect timing values

This commit is contained in:
Paul Romano 2018-10-31 07:23:58 -05:00
parent 33e05e330e
commit 9a772539bf
2 changed files with 2 additions and 2 deletions

View file

@ -31,7 +31,7 @@ public:
private:
bool running_ {false}; //!< is timer running?
std::chrono::time_point<clock> start_; //!< starting point for clock
double elapsed_; //!< elasped time in [s]
double elapsed_ {0.0}; //!< elasped time in [s]
};
//==============================================================================

View file

@ -28,7 +28,7 @@ double Timer::elapsed()
{
if (running_) {
std::chrono::duration<double> diff = clock::now() - start_;
return elapsed_ += diff.count();
return elapsed_ + diff.count();
} else {
return elapsed_;
}