Find amount of time something has happened for?

Hello. How would I find out the amount of time something has happened for?

Example:

function update(){
       if(*seconds code goes here*){
  //do something
}
}

When the action starts:

startTime = Time.time;

Amount of time that has passed:

timePassed = Time.time-startTime;