[Solved]Measuring time between two sensor data .

I have two variables in my sketch that gives me 2 separate data . like -

lightA = 100 ; lightB = 80;

What i want to do is that , when lighA is 100 it will start counting time (In seconds) and when lightB is 50 it will stop counting and give me the time . I have found a sketch in this forum which works as a stopwatch and provides time in seconds . Here is the code

/*  CrossRoads Time-clock  */

unsigned long previousTime = 0;
byte seconds ;
byte minutes ;
byte hours ;
void setup()
{
Serial.begin (9600);
}

void loop ()
{
// I  think using microseconds is even more accurate
  if (millis() >= (previousTime)) 
  {
     previousTime = previousTime + 1000;  // use 100000 for uS
     seconds = seconds +1;
     if (seconds == 60)
     {
        seconds = 0;
        minutes = minutes +1;
     }
     if (minutes == 60)
     {
        minutes = 0;
        hours = hours +1;
     }
     if (hours == 13)
     {
        hours = 1;
     }

  Serial.println(seconds,DEC);
  } // end 1 second
} // end loop

I am using if condition to start the counting . But i am not finding a way to stop counting when lightB = 50;

I am using 123d.circuits.io for practicing . So if anyone needs to see my design i can provide it.

Thanks in advance

What i want to do is that , when lighA is 100 it will start counting time (In seconds) and when lightB is 50

Wanting those exact values to trigger events is probably unrealistic. Wanting to record when a reading goes above a threshold, or when a reading goes below a threshold makes sense.

I am using if condition to start the counting

But not one based on reading a sensor.

But i am not finding a way to stop counting when lightB = 50;

if(supposedToBeCountingTime && lightB <= 50)
{
   supposedToBeCounting = false;
}

if(supposedToBeCounting)
{
   // do the counting
}

Bonus points if you can figure out the type for supposedToBeCounting and where it is to be declared, and where it is to be set to true.