diff --git a/core/src/main/java/com/threerings/presents/server/RebootManager.java b/core/src/main/java/com/threerings/presents/server/RebootManager.java index 548b04ddd..1b4bb2f88 100644 --- a/core/src/main/java/com/threerings/presents/server/RebootManager.java +++ b/core/src/main/java/com/threerings/presents/server/RebootManager.java @@ -6,6 +6,7 @@ package com.threerings.presents.server; import java.util.Calendar; +import java.util.TimeZone; import com.samskivert.util.Calendars; import com.samskivert.util.HashIntMap; @@ -63,13 +64,12 @@ public abstract class RebootManager { // maybe schedule an automatic reboot based on our configuration int freq = getDayFrequency(); - int hour = getRebootHour(); - if (freq <= 0) { - return false; - } + if (freq <= 0) return false; - Calendars.Builder cal = Calendars.now(); + var tz = getRebootTimeZone(); + var cal = tz == null ? Calendars.now() : Calendars.in(tz); int curHour = cal.get(Calendar.HOUR_OF_DAY); + int hour = getRebootHour(); cal = cal.zeroTime().addHours(hour).addDays((curHour < hour) ? (freq - 1) : freq); // maybe avoid weekends @@ -222,6 +222,14 @@ public abstract class RebootManager */ protected abstract int getRebootHour (); + /** + * Return the time zone we're using for reboot calculations, or null for current (legacy). + */ + protected TimeZone getRebootTimeZone () + { + return null; + } + /** * Returns true if the reboot manager should avoid scheduling automated reboots on the * weekends.