diff --git a/src/main/java/com/sheepit/client/standalone/Worker.java b/src/main/java/com/sheepit/client/standalone/Worker.java index 47b25da..f32222e 100644 --- a/src/main/java/com/sheepit/client/standalone/Worker.java +++ b/src/main/java/com/sheepit/client/standalone/Worker.java @@ -238,8 +238,20 @@ public class Worker { config.getRequestTime().add(new Pair(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(start, midnightBefore)); + config.getRequestTime().add(new Pair(midnightAfter, end)); + } + catch (ParseException e) { + System.err.println("Failed to parse date"); + System.exit(2); + } } } }