diff --git a/include/openmc/timer.h b/include/openmc/timer.h index 1b4d71a5c7..48b3a9e75d 100644 --- a/include/openmc/timer.h +++ b/include/openmc/timer.h @@ -31,7 +31,7 @@ public: private: bool running_ {false}; //!< is timer running? std::chrono::time_point start_; //!< starting point for clock - double elapsed_; //!< elasped time in [s] + double elapsed_ {0.0}; //!< elasped time in [s] }; //============================================================================== diff --git a/src/timer.cpp b/src/timer.cpp index 46a84a6f1e..f1c2114467 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -28,7 +28,7 @@ double Timer::elapsed() { if (running_) { std::chrono::duration diff = clock::now() - start_; - return elapsed_ += diff.count(); + return elapsed_ + diff.count(); } else { return elapsed_; }