It would be fairly easy in PLEG. In fact there is an example in the latest version of PLEG Basics that shows a similar application (Duty-cycle).
You could also do it with Lua, of course. You could use the Not_Tripped trigger with Lua code (assuming UI5) to update a device variable with the accumulated on-time. Another trigger scheduled for 00:00:01 could reset the accumulator.
Best Home Automation shopping experience. Shop at Ezlo!