From f2f4782b06cf19cf9f7d3a9d88016717ee3d5f58 Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Fri, 29 Mar 2019 12:49:15 -0400 Subject: [PATCH] Adjusted string output to show minutes and hours when the previous resolutionis over 120 --- Stopwatch.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Stopwatch.hpp b/Stopwatch.hpp index aceb2a8..a8c723d 100644 --- a/Stopwatch.hpp +++ b/Stopwatch.hpp @@ -157,6 +157,17 @@ public: } --timeRes; //Take this variable back down to the right place. It has to go one too far to trigger the loop stop + //Check if the resolution is seconds and if there are more than 120 seconds + if((timeRes == SECOND) && (tempTime >= 120)){ + ++timeRes; + tempTime = getTime(static_cast(timeRes)); + } + //Check if the resolution is minutes and if there are more than 120 minutes + else if((timeRes == MINUTE) && (tempTime >= 120)){ + ++timeRes; + tempTime = getTime(static_cast(timeRes)); + } + //Put the number in the string timeStr << std::fixed << std::setprecision(3) << tempTime << ' ';