[pve-devel] [PATCH common 0/3] CalendarEvent fixes
Wolfgang Bumiller
w.bumiller at proxmox.com
Wed Oct 31 10:54:15 CET 2018
This series changes CalendarEvent::compute_next_event to not translatee
back and forth between time stamps and calendar time at each iteration,
as this can cause endless loops (see patch 1 for an example trigger
code and patch 3 for test cases).
The problem here lies in the fact that when converting a timestamp to
calendar time there are calendar times which exist twice, and when
converting them back to a time stamp there are two possible results, of
which we of course only get 1 back.
This can result in a case where we're trying to schedule an event to
happen "in an hour" - which is a change, causing our loop to re-iterate
from the beginning, starting with converting the new time stamp back and
forth, bringing it back to its original value (because the time exists
twice). After that we repeat the "in an hour" step, and, having changed
the value again, we re-iterate from the top. And so it continues.
So we now stay in calendar time (and have to take care to wrap around
minutes/hours/days/... when incrementing components).
This on the other hand can result in a schedule for fixed times (eg.
2am in the morning) to happen twice if the server is using local time.
If this is a problem, time specs can now optionally take a 'UTC' flag at
the end to cause everything to happen in UTC.
Wolfgang Bumiller (3):
fix #1963: don't do day-time related math on time stamps
CalendarEvent: add 'utc' flag to calendar specs
tests: update to utc flag and add daylight savings test
src/PVE/CalendarEvent.pm | 182 +++++++++++++++++++++++++++++---------------
test/calendar_event_test.pl | 35 ++++++++-
2 files changed, 152 insertions(+), 65 deletions(-)
--
2.11.0
More information about the pve-devel
mailing list