From 6e464e132f8158bfdc5b9b711c73d9b6f3f16723 Mon Sep 17 00:00:00 2001 From: "Ray J. Greenwell" Date: Mon, 2 Mar 2026 13:27:54 -0800 Subject: [PATCH] Allow the reboot manager to specify a time zone... A balance between: This is obnoxious, I should fix it in my subclass and/or we should be compositing functionality, not subclassing... but adding a time zone to this old thing seems fundamental anyway and this is an easy fix. --- .../presents/server/RebootManager.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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.