Timing issues

Hi there. Another non programmer/coder...

I have managed to set up my Arduino UNO with a DF robot pH sensor and 2 x 5 Volt relay. Everything works. I can get relays to energise and deenergise with IF statement no problem. I also use the millis() function to to get the pH vs time. The millis() function is accurate enough.

My challenge is to run a complete titration and at certain pH thresholds, I need to get the time in seconds. Example; time lapsed between start and pH1, time lapsed between pH1 and pH2. I cannot stop the titration. That part loops until pH2 is reached which then writes to the digital pin my relay is connected to. So, my question is how do I go about measuring the elapsed time, store the values and then, once the relay is de-energised, perform a calculation. I want to keep it all embedded.

Can I use the pulseln function? How would I go about doing this? Do I write to a digital pin each time the threshold pH is reached and then use the pulse(ln) function.

I am stumped and have used days on this. I need a few pointers.

Thanks, that seems easy enough? So would it be something like this?

IF phvalue < threshold1
THEN time1 = millis()
ELSE IF phvalue < threshold2
THEN time2 = millis()

? Does millis() continue running and you basically "grab" that value and hold it to a variable?

Thanks again