Commit f5c222606a97b81295f935aa31038cf7c8c26fc2
1 parent
f36b2a3d
update...
Showing
1 changed file
with
4 additions
and
3 deletions
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -786,13 +786,14 @@ public class DayOfSchedule { |
| 786 | 786 | Collections.sort(list, schFCSJComparator); |
| 787 | 787 | |
| 788 | 788 | long t = System.currentTimeMillis(); |
| 789 | - int distance=-1; | |
| 789 | + int distance=-1, diff; | |
| 790 | 790 | |
| 791 | 791 | ScheduleRealInfo sch = null; |
| 792 | 792 | for(ScheduleRealInfo temp : list){ |
| 793 | - | |
| 794 | - if(Math.abs(temp.getDfsjT() - t) < distance || distance == -1){ | |
| 793 | + diff = (int) Math.abs(temp.getDfsjT() - t); | |
| 794 | + if(diff < distance || distance == -1){ | |
| 795 | 795 | sch = temp; |
| 796 | + distance = diff; | |
| 796 | 797 | } |
| 797 | 798 | } |
| 798 | 799 | return sch; | ... | ... |