Skip to content

Commit

Permalink
fix issue ctasada#7.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericcitaire committed Aug 23, 2013
1 parent 4ada3e9 commit 3ef2b0e
Showing 1 changed file with 50 additions and 55 deletions.
Expand Up @@ -369,37 +369,34 @@ public void increaseValue() {
}

public void increaseValue(boolean fireEvents) {
//if (timeValue < 24.0) {
if (timeValue.getHours() < 24) {
int hours = timeValue.getHours();
int oldHours = hours;

int minutes = timeValue.getMinutes();
int oldMinutes = minutes;

if (minutesSteps == 15) {
if (minutes < 15) {
minutes = 15;
} else if (minutes < 30) {
minutes = 30;
} else if (minutes < 45) {
minutes = 45;
} else {
minutes = 0;
hours++;
if (hours > 23) {
hours = 0;
}
}
int hours = timeValue.getHours();
int oldHours = hours;

int minutes = timeValue.getMinutes();
int oldMinutes = minutes;

if (minutesSteps == 15) {
if (minutes < 15) {
minutes = 15;
} else if (minutes < 30) {
minutes = 30;
} else if (minutes < 45) {
minutes = 45;
} else {
minutes++;
minutes = 0;
hours++;
if (hours > 23) {
hours = 0;
}
}
} else {
minutes++;
}

if ((oldMinutes != minutes) || (oldHours != hours)) {
timeValue.setHours(hours);
timeValue.setMinutes(minutes);
setValue(timeValue.getTime(), fireEvents);
}
if ((oldMinutes != minutes) || (oldHours != hours)) {
timeValue.setHours(hours);
timeValue.setMinutes(minutes);
setValue(timeValue.getTime(), fireEvents);
}
}

Expand All @@ -408,36 +405,34 @@ public void decreaseValue() {
}

public void decreaseValue(boolean fireEvents) {
if (timeValue.getHours() > 0.0) {
int hours = timeValue.getHours();
int oldHours = hours;

int minutes = timeValue.getMinutes();
int oldMinutes = minutes;

if (minutesSteps == 15) {
if (minutes >= 45) {
minutes = 30;
} else if (minutes >= 30) {
minutes = 15;
} else if (minutes >= 15) {
minutes = 0;
} else {
minutes = 45;
hours--;
if (hours < 0) {
hours = 23;
}
}
int hours = timeValue.getHours();
int oldHours = hours;

int minutes = timeValue.getMinutes();
int oldMinutes = minutes;

if (minutesSteps == 15) {
if (minutes >= 45) {
minutes = 30;
} else if (minutes >= 30) {
minutes = 15;
} else if (minutes >= 15) {
minutes = 0;
} else {
minutes--;
minutes = 45;
hours--;
if (hours < 0) {
hours = 23;
}
}
} else {
minutes--;
}

if ((oldMinutes != minutes) || (oldHours != hours)) {
timeValue.setHours(hours);
timeValue.setMinutes(minutes);
setValue(timeValue.getTime(), fireEvents);
}
if ((oldMinutes != minutes) || (oldHours != hours)) {
timeValue.setHours(hours);
timeValue.setMinutes(minutes);
setValue(timeValue.getTime(), fireEvents);
}
}

Expand Down

0 comments on commit 3ef2b0e

Please sign in to comment.