Fixed bug where the incorect time may be given

when using the getString function
This commit is contained in:
2019-08-02 15:32:46 -04:00
parent 0053c930a1
commit df9a7cee82

View File

@@ -1,7 +1,7 @@
#Python/pyClasses/Stopwatch.py #Python/pyClasses/Stopwatch.py
#Matthew Ellison #Matthew Ellison
# Created: 01-27-19 # Created: 01-27-19
#Modified: 03-29-19 #Modified: 08-02-19
#This is a class that is used to time program run times #This is a class that is used to time program run times
""" """
Copyright (C) 2019 Matthew Ellison Copyright (C) 2019 Matthew Ellison
@@ -116,17 +116,18 @@ class Stopwatch:
resCnt += 1 resCnt += 1
#If the resolution counter reached 3 we may need to change to minutes or hours #If the resolution counter reached 3 we may need to change to minutes or hours
#Check if seconds is low enough resolution if(resCnt == 3):
if(time >= 120): #Check if seconds is low enough resolution
#If not, change it to minutes if(time >= 120):
time /= 60 #If not, change it to minutes
resCnt += 1 time /= 60
resCnt += 1
#Check if minutes is low enough resolution #Check if minutes is low enough resolution
if(time >= 120): if(time >= 120):
#If not, change it to hours #If not, change it to hours
time /= 60 time /= 60
resCnt += 1 resCnt += 1
#Create a string with the number at ___.___ resolution #Create a string with the number at ___.___ resolution
timeString = "" timeString = ""