Code example for GregorianCalendar

Methods: add, getTime, getTimeInMillis

0
                    // reboot tomorrow! 
                    int[] rebootTime = OtherSettings.getUserSpecifiedRebootTime(this);
                    Calendar cal = Calendar.getInstance();
                    boolean nextDay = cal.get(Calendar.HOUR_OF_DAY) > rebootTime[0]
                            && cal.get(Calendar.MINUTE) > rebootTime[1];
                    GregorianCalendar d = new GregorianCalendar(cal.get(Calendar.YEAR),
                            cal.get(Calendar.MONTH), nextDay ? cal.get(Calendar.DATE) + 1
                                    : cal.get(Calendar.DATE), rebootTime[0], rebootTime[1]);
                    d.add(Calendar.DATE, 1);
                    scheduleReboot(d.getTimeInMillis());
                    log("too many reschedule attempts; rescheduled for tomorrow, at: " 
                            + d.getTime().toString());
                } else { 
                    rescheduledCount++;
                    // reschedule with backoff 
                    Date rescheduleTime = scheduleReboot();
                    log("rescheduled reboot for : " + rescheduleTime.toString());
                } 
            } else { 
                if (rescheduledCount == 0) {
                    // regular schedule