Feat: allow request time for 'night'
This commit is contained in:
@@ -238,8 +238,20 @@ public class Worker {
|
||||
config.getRequestTime().add(new Pair<Calendar, Calendar>(start, end));
|
||||
}
|
||||
else {
|
||||
System.err.println(String.format("ERROR: The start (%s) time must be earlier than the finish (%s) time", times[0], times[1]));
|
||||
System.exit(2);
|
||||
// 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
|
||||
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