Calculate duration with ruby code

That is what I would expect if you have pipeline.java_execution enabled. The three ON events are processed first, then the three OFF events, so only one of them gets an elapsed time added.