From eb44a6d6f38bc2a7b9d0f65f38d97741ba2c80d7 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Tue, 16 Jun 2020 22:26:04 -0400 Subject: [PATCH] Fixed bug that caused incorrect resolution label --- src/main/java/mattrixwv/Stopwatch.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/mattrixwv/Stopwatch.java b/src/main/java/mattrixwv/Stopwatch.java index 62d7bdd..95771d4 100644 --- a/src/main/java/mattrixwv/Stopwatch.java +++ b/src/main/java/mattrixwv/Stopwatch.java @@ -105,16 +105,17 @@ public class Stopwatch{ duration /= 1000; } //Check if the duration needs reduced to minutes - if(duration >= 120){ + if((duration >= 120) && (resolution == TIME_RESOLUTION.SECOND)){ //Reduce to minutes duration /= 60; resolution = TIME_RESOLUTION.values()[resolution.ordinal() + 1]; - } - //Check if the duration needs reduced to hours - if(duration >= 60){ - //Reduce to hours - duration /= 60; - resolution = TIME_RESOLUTION.values()[resolution.ordinal() + 1]; + + //Check if the duration needs reduced to hours + if(duration >= 60){ + //Reduce to hours + duration /= 60; + resolution = TIME_RESOLUTION.values()[resolution.ordinal() + 1]; + } } //Turn the number into a string