From df9a7cee829b578f2ad6f0197c3734bdd8587467 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Fri, 2 Aug 2019 15:32:46 -0400 Subject: [PATCH] Fixed bug where the incorect time may be given when using the getString function --- Stopwatch.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Stopwatch.py b/Stopwatch.py index fd4ebbb..3c9626c 100644 --- a/Stopwatch.py +++ b/Stopwatch.py @@ -1,7 +1,7 @@ #Python/pyClasses/Stopwatch.py #Matthew Ellison # Created: 01-27-19 -#Modified: 03-29-19 +#Modified: 08-02-19 #This is a class that is used to time program run times """ Copyright (C) 2019 Matthew Ellison @@ -116,17 +116,18 @@ class Stopwatch: resCnt += 1 #If the resolution counter reached 3 we may need to change to minutes or hours - #Check if seconds is low enough resolution - if(time >= 120): - #If not, change it to minutes - time /= 60 - resCnt += 1 + if(resCnt == 3): + #Check if seconds is low enough resolution + if(time >= 120): + #If not, change it to minutes + time /= 60 + resCnt += 1 - #Check if minutes is low enough resolution - if(time >= 120): - #If not, change it to hours - time /= 60 - resCnt += 1 + #Check if minutes is low enough resolution + if(time >= 120): + #If not, change it to hours + time /= 60 + resCnt += 1 #Create a string with the number at ___.___ resolution timeString = ""