code: public boolean scheduleRegularReboot ()
      {
          // maybe schedule an automatic reboot based on our configuration
          int freq = getDayFrequency();
          int hour = getRebootHour();
          if (freq <= 0) {
              return false;
          }
  
          Calendars.Builder cal = Calendars.now();
          int curHour = cal.get(Calendar.HOUR_OF_DAY);
          cal = cal.zeroTime().addHours(hour).addDays((curHour < hour) ? (freq - 1) : freq);
  
          // maybe avoid weekends
          if (getSkipWeekends()) {
              switch (cal.get(Calendar.DAY_OF_WEEK)) {
              case Calendar.SATURDAY:
                  cal.addDays(2);
                  break;
  
              case Calendar.SUNDAY:
                  cal.addDays(1);
                  break;
              }
          }
  
          scheduleReboot(cal.toTime(), true, AUTOMATIC_INITIATOR); // schedule exactly
          return true;
      }
docs: Schedules our next regularly scheduled reboot.
  
  @return true if a reboot was scheduled, false if regularly scheduled reboots are disabled.