Skip to content

Commit

Permalink
Fixed bug with time conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeByDrescher committed Jan 30, 2025
1 parent 625774a commit 6d1422b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ protected void setTimeout(long timeout, TimeUnit timeUnit) {
if (this.timeout == 0) return;

// Calculate equivalent times for human readability (only works for whole units)
if (timeUnit == TimeUnit.MILLISECONDS && timeout % 1000 == 0){
if (this.timeUnit == TimeUnit.MILLISECONDS && this.timeout % 1000 == 0){
this.timeout /= 1000;
this.timeUnit = TimeUnit.SECONDS;
}

if (timeUnit == TimeUnit.SECONDS && timeout % 60 == 0){
if (this.timeUnit == TimeUnit.SECONDS && this.timeout % 60 == 0){
this.timeout /= 60;
this.timeUnit = TimeUnit.MINUTES;
}

if (timeUnit == TimeUnit.MINUTES && timeout % 60 == 0){
if (this.timeUnit == TimeUnit.MINUTES && this.timeout % 60 == 0){
this.timeout /= 60;
this.timeUnit = TimeUnit.HOURS;
}
Expand Down

0 comments on commit 6d1422b

Please sign in to comment.