[jsr223 Jython] CRON trigger fire some milliseconds before the right time

Hi All,
I’m facing a very weird issue with jsr223 script (jython).
I have a cron trigger defined as:

TimerTrigger("0 * * * * ?")

It should fires every minutes at second 0.
But sometime this trigger fires just some milliseconds before the second 0!

2017-02-21 17:08:59.999 [INFO ] [nhab.model.jsr223.AlarmManager] - DEBUG ERROR --> Minute Trigger FIRED before SEC == 0 (  2017-02-21 17:08:59.999000  )```

This is a problem in my case becouse with a single cron expression I want to have 3 triggers: minute (sec=0), hour (sec=0 AND min=0) and day (sec=0 AND min=0 AND hour=0)

Current workaround is to check, for the minute trigger:

 if ( (nowSec == 0 or nowSec == 59 ) and nowMin != 0 and nowHour != 0):

comments? thoughts? suggestions?


Why don’t you use a cron like:

Time cron “59,0 1-59 1-23 * * ?”

Or did I misread your requirement?

No, It is not what I need…

@villaRob, this is not a jsr223 or jython-specific issue. The Quartz scheduler is the same one used by the standard rule engine.

Most, if not all, operating systems running openHAB are not real time operating systems. I’m not surprised that the timer callbacks occur with a few milliseconds of the scheduled time. Actually, I’m a bit surprised it’s that accurate.