You could use Event Frames in AF and map the event duration to a PI Tag as one of the attributes on the Event Frame. This way, when the Event Frame closes, you'll know how long it lasted. You can also convert the duration into any format you need (string, seconds, minutes, hours, etc).
do you have any videos or guides that could help me with this? I couldnt access the Knowledge document you attached and the other document wasnt enough to help me understand how to perform this action.
Something as basic as this could be the base for what you need. You can modify the output to be in the format that you need.