Hi,
Paweł Zmarzły <[email protected]> skribis:
> I am considering using shepherd timers as crontab replacement. But I
> want to first make sure they work correctly on time, timezone and
> daylight-saving changes. In my experience with systemd, it can truly
> be a minefield, e.g.
[...]
> Can someone confirm that shepherd timers do not have the same bugs?
Unfortunately those bugs exist as of Shepherd 1.0.1.
The main issue is that the timer waits like this (from (shepherd service
timer)):
(get-message* channel (seconds-to-wait event)
'timeout 'overslept)
where ‘seconds-to-wait’ naively assumes there won’t be DST or timezone
changes in the interim:
(define (seconds-to-wait event)
"Return the number of seconds to wait before the next occurrence of
@var{event} (the result is an inexact number, always greater than zero)."
(let* ((now (current-time time-utc))
(then (next-calendar-event event (time-utc->date now)))
(diff (time-difference (date->time-utc then) now)))
(+ (time-second diff)
(/ (time-nanosecond diff) 1e9))))
It would be possible for ‘seconds-to-wait’ to account for forthcoming
DST changes; that should be fixed (mcron seems to get that right).
As for timezone updates (other than DST, meaning: when traveling),
shepherd would need to be notified somehow, and I’m not sure whether
there exists a standard (non-Freedesktop) way to get that info.
Suggestions welcome!
Ludo’.