It triggered 77 msec before the START. For a system like openHAB with all that is going on in parallel I’d call that about as close as it can get.
But that 77 msec shouldn’t cause the events to not occur in the first place.
Which one was right? Did they both trigger at -90 or both trigger at local?
Indeed, and indeed this does show how that few msec could be a problem, especially on a fast machine that can handle the event and kick off the rule faster than that 77 msec.
So I’ve totally reworked the time of day DP in Jython to no longer rely on the events from Astro and manually written cron triggers so that might be why I’ve not seen this behavior. Unfortunately the approach it uses relies on Item metadata which is unavailable in Rules DSL. The good news is when/if you move in that direction all you have to do is define your Items and drop the library into /etc/openhab2/automation.
As a work around one could add a 100-300 msec sleep at the start of the Rule, or even better add 100-300 msec to
now for the comparisons. The amount of time just needs to be long enough to cover most if not all of the rounding error cases. That’s not really a satisfactory solution but it would work.
It seems odd that it would round at all IMO, and this must be something new as if this were happening before I imagine there would be more reports of problems before now with the ToD rule. If it didn’t work 50% of the time I would have expected to hear about this behavior before now.
Another source of the problem could be that Astro has been rounding all this time but something changed to make the rule kick off some 100 msec faster. But that would almost have to include changes from core and there have been none of those since 2.5.0.
See above, add a few msec to
now before the switch statement. That will push the comparison past the rounding error. You’ll have to experiment to find the optimal number. Based on the logs above 100 should cover it, but that’s based on a sample of 1.
I don’t think there is any way to adjust this at the trigger short of changing the Thing definition. But that fees as awkward as just adding a few msec to
now in the Rule.