diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-04-05 19:35:15 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-04-05 19:35:21 +0100 |
commit | fedeabc693a7450e24ed202e2e57388439d5d05a (patch) | |
tree | 65208b9afed955a7888f1a26a266e15109ec94ae /scripts/toy.groovy | |
parent | Tidy docs and update a bit (diff) | |
download | toy-fedeabc693a7450e24ed202e2e57388439d5d05a.zip |
Fix timezone offset bug with scheduling events
Diffstat (limited to 'scripts/toy.groovy')
-rw-r--r-- | scripts/toy.groovy | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy index b0155e7..a769153 100644 --- a/scripts/toy.groovy +++ b/scripts/toy.groovy @@ -1502,7 +1502,7 @@ def playEvent = { rt = true, first = true -> showLounge(); } def sleepSchedule = { - def t = (int)(getDay() + localTimeOffset() + (25.1 * HOUR) + getRandom((int)HOUR)); + def t = (int)(getDay() - localTimeOffset() + (25.1 * HOUR) + getRandom((int)HOUR)); addEventIfMissing(SLEEPING, t, BEDTIME); }; def bedtime = { rt, schedTime -> @@ -1711,7 +1711,7 @@ def confess = { // Setup // Plans - cannot overlap def setupPlan = { plan, float startmin, float startmax, float endmin, float endmax -> - def timeWindow = { float min, float max -> (int)((min * HOUR) + localTimeOffset() + getRandom((int)((max - min) * HOUR))) }; + def timeWindow = { float min, float max -> (int)((min * HOUR) - localTimeOffset() + getRandom((int)((max - min) * HOUR))) }; final friendName = FRIENDS[getRandom(FRIENDS.size())]; def day = getDay() + ((getRandom(3) + 1) * DAY); addEventIfMissing(plan, day + timeWindow(startmin, startmax), BEGINPLAN, @@ -1885,7 +1885,7 @@ def setupShowCalendar = { setDefault("toy.owner", "ancilla"); OWNER = loadString("toy.owner"); DOMME = loadDomme(OWNER); -def getDayNum = { Math.floorDiv(getTime() + localTimeOffset() - 14400, 86400) }; +def getDayNum = { Math.floorDiv(getTime() - localTimeOffset() - 14400, 86400) }; def getAvail = { dayNum -> loadInteger("toy.availability.$dayNum") ?: 0 }; def addAvail = { amount -> def dayNum = getDayNum(); |