Using millis to measure intervals to trigger a digital output

mcclocu:
My code will be used to measure the pulse of the user. If their pulse is below a certain threshold, the user will be shocked by a dog collar until they get their heart rate back up.

That sounds quite dangerous.