How to capture event time duration based on two condition

I think this post will help.