Feat: allow request time for 'night'

This commit is contained in:
Laurent Clouet
2023-06-08 19:33:28 +02:00
parent 2102cfbacd
commit 14c4f02d6d

View File

@@ -238,13 +238,25 @@ 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]));
// 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);
}
}
}
}
}
}
if (nb_cores < -1 || nb_cores == 0) { // -1 is the default
System.err.println("ERROR: The entered number of CPU cores (-cores parameter) is not valid. Please enter a number greater than zero");