Merge branch 'feat/request-time-night' into 'master'
Feat: allow request time for 'night' See merge request sheepitrenderfarm/client!219
This commit is contained in:
@@ -238,8 +238,20 @@ public class Worker {
|
|||||||
config.getRequestTime().add(new Pair<Calendar, Calendar>(start, end));
|
config.getRequestTime().add(new Pair<Calendar, Calendar>(start, end));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.err.println(String.format("ERROR: The start (%s) time must be earlier than the finish (%s) time", times[0], times[1]));
|
// example: for a night render, 20:00,07:00 we will create 2 intervals for it: 20:00-23:59 and 00:00-07:00
|
||||||
System.exit(2);
|
try {
|
||||||
|
Calendar midnightBefore = Calendar.getInstance();
|
||||||
|
midnightBefore.setTime(timeFormat.parse("23:59"));
|
||||||
|
Calendar midnightAfter = Calendar.getInstance();
|
||||||
|
midnightAfter.setTime(timeFormat.parse("00:00"));
|
||||||
|
|
||||||
|
config.getRequestTime().add(new Pair<Calendar, Calendar>(start, midnightBefore));
|
||||||
|
config.getRequestTime().add(new Pair<Calendar, Calendar>(midnightAfter, end));
|
||||||
|
}
|
||||||
|
catch (ParseException e) {
|
||||||
|
System.err.println("Failed to parse date");
|
||||||
|
System.exit(2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user